Skip to content

Instantly share code, notes, and snippets.

@damieng
Last active December 17, 2019 23:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damieng/a13f56209877d186cc44bbb989514d5c to your computer and use it in GitHub Desktop.
Save damieng/a13f56209877d186cc44bbb989514d5c to your computer and use it in GitHub Desktop.
Reset WiFi adapter on wake
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2019-12-17T10:49:39.5675591</Date>
<URI>\Wake on WiFi</URI>
</RegistrationInfo>
<Triggers>
<EventTrigger>
<Enabled>true</Enabled>
<Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="System"&gt;&lt;Select Path="System"&gt;*[System[Provider[@Name='Microsoft-Windows-Power-Troubleshooter' or @Name='power'] and (EventID=1)]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
</EventTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-1650062903-38148289-4023207939-1001</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>netsh</Command>
<Arguments>interface set interface name="Wi-Fi" admin=disabled</Arguments>
</Exec>
<Exec>
<Command>netsh</Command>
<Arguments>interface set interface name="Wi-Fi" admin=enabled</Arguments>
</Exec>
</Actions>
</Task>
@damieng
Copy link
Author

damieng commented Dec 17, 2019

Import this into Task Scheduler. Adjust lines 45 and 49 to match the name of your Wi-Fi device as obtained by netsh interface show interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment