My job at the front desk has me connecting to the Wifi router in the lounge upstairs. This router has DHCP disabled and has to be configured manually. I don’t want to do that every time and would like to automate it. I’m using Windows 7 on my laptop so the solution for this is to use task scheduler.
First thing is you need to go into Event Viewer. Navigate to Applications and Services Logs > Microsoft Windows > WLAN-AutoConfig > Operational
Right click on the operational event on the left and select “Attach task to this event”.
A new window will pop up asking you for details. Enter a useful name and a description. Click next, then you will see selecting a program you want to run. Ignore this for now or point it to a batch script. On the last window where is says finish check the box that says “Open the Properties dialog for this task when I click Finish”.
This task is run when you connect to any wireless network, but we need to limit it to only a particular one based on its SSID.
Click on the triggers tab of the task properties window. You should see one trigger in the middle list, click on it and then click “Edit…”
On the settings panel which it from basic to custom, then click the new button “Add Event Filter…”
On the new window, click the XML tab. On the bottom you should see a check box with “Edit query manually” check that and in the now typeable box enter the following:
<Query Id="0" Path="Microsoft-Windows-WLAN-Autoconfig/Diagnostic">
<Select Path="Microsoft-Windows-WLAN-AutoConfig/Operational">*[System[Provider[@Name='Microsoft-Windows-WLAN-AutoConfig']]] and *[EventData[Data[@Name='SSID']='MyWifi']] </Select>
<Select Path="System">*[System[Provider[@Name='Microsoft-Windows-WLAN-AutoConfig']]] and *[EventData[Data[@Name='SSID']='MyWifi']]</Select>
Change “MyWifi” to whatever Wifi network you want it to be activated on. If you ever need the pure version of this you can find it under the filter tab, then selecting the “By source” option. WLAN-AutoConfig would be the option you select in the Event sources drop down list. You can edit it on the XML side, but take note that I removed the first Select statement and included the additional clause for the SSID.