USB Auto Update GuideGuest_Jim_* -
» Discuss this article (4)
Creating the Task:
There are two ways to create the USB Update task. One is to find the correct event in the Event Viewer and use the 'Attach Task To This Event' command. The other way, which is easier, is to use the XML file given later in this guide. As you will not learn as much from just importing the file, I am also going to go through the long way, because I care.
First step is to open the Event Viewer. It can be found within the Control Panel under 'System and Security,' 'Administrative Tools,' 'View event logs.' Alternatively, you can just search for it.
Once you open it, you want to follow the tree down 'Applications and Services Logs,' 'Microsoft,' 'Windows,' and then find the 'DriverFrameworks-UserMode,' folder. In there, you want to find the event with Event ID 2101, which I believe is the event associated with Windows giving the USB drive power.
Now you can either Right-Click the event or click the button on the right side of the viewer labeled 'Attach Task To This Event.' Now a window should pop up to direct you through the process of creating a new task. The first step is to name and describe it:
The second step is already filled out because we are attaching the task to the event. The third step is to select what the task is going to do. We want 'Start a Program.'
Now we need to give it a program to run, so I have given it "E:\USB Update.bat." The quotes are important here as there is a space in the name. If you are only using a single USB drive, you should be able to have the task just run the file with all of the update instructions. If you have multiple USB drives or if Windows likes to change the drive letter of the USB drive, the task will have to run a different batch file, which I will explain later in this guide.
The final step just shows you the options so you can fix any mistake.
Once you finish creating the task through the Event Viewer, you can leave and close it. To make any changes to the task you will need to open the Task Scheduler and find it under 'Event Viewer Tasks.'
If you want to import the XML file instead of manually creating the task from an event, open the Task Scheduler and use either the button on the right labeled 'Import Task...' or select it under the Action drop down menu. Just navigate to the XML file and open it. I have removed the information from it that would connect it to my computers. It does however use an Environment Variable: DataDrive. This is because I keep the USB Update.bat file on different drives between my two computers. You can just replace the variable with the correct drive letter or use your own variable. Don't know how to create an Environment Variable? Don't worry, that's the next step and the start of our trip down the rabbit hole.
USB Updater.zip (Contains the XML file to be imported.)
Creating Environment Variables
To create an Environment Variable, you have to get to your system properties, which is really easy. Just open My Computer and click the 'System properties' button on the top. From there click 'Advanced system settings' on the left, which will open a window with an 'Environment Variables...' button on the bottom. Clicking that will open another window that shows you all of the User and System variables. I put my variables under the User variables, but I do not believe it matters which you use; just click the 'New?' button. Now you will get another window asking for the variable name and value. I just use two: DataDrive which is 'E:' and 'JimContent' which is 'E:\Users\Jim,' the location of my user folder on my desktop. On my laptop the values reference the C drive instead of the E drive.
That's all there is to creating an Environment Variable! Just remember that to use the variable you must surround it with '%' signs. Now for the
confusing fun part.