UPDATE: 2015-11-19 - Last week I spoke to a member of the Microsoft Surface technical team at Future Decoded in London and they told me that the Surface Pro 4 has the same WiFi chipset as the Surface Pro 3. This means that if you experience the same issue on a Surface Pro 4 then this fix should also work without modification. If this happens to you, please let me know in the comments section.
UPDATE: 2015-10-26 - This has also helped people running Windows 10 on their Surface Pro 3. And I've added a note about checking the name of the WiFi interface. Thanks to the commenters who have helped with this.
If you have a Surface Pro 3 or any other Windows 8.1 or Windows 10 device and are having WiFi issues when resuming from sleep/hibernate and often have to reset your wireless network adapter or reboot to reconnect to WiFi then this might help. Just download the fix from https://github.com/TomChantler/Restart-WiFi-Adapter and import it into your Task Scheduler by running
install.bat and it should automatically reset your WiFi adapter each time you resume from sleep/hibernate. It's a one-click procedure which doesn't install any files.
First a bit of background information about the Surface Pro 3
I used to have a huge laptop which weighed about three tonnes and had a battery life which eventually dwindled to less than five minutes. It was really powerful, but its other attributes meant that I never actually took it anywhere and it was effectively just a rather expensive flat desktop machine with an integral hinged screen. I never used it away from a desk and a power supply.
A couple of months ago I bought a Surface Pro 3 after reading a few very positive reviews, like this one written by Scott Hanselman which seems very fair and honest.
The Surface Pro 3 was something of a revelation for me. Here was a machine which was actually portable, rather than merely being luggable; a machine which didn't destroy the straps on any bag hapless enough to contain it; a machine which could do everything my laptop could do and could be used on my lap. You get the idea.
The WiFi issues
Unfortunately a lot of users had WiFi connectivity problems, particularly when resuming from sleep/hibernate. Apparently these were all fixed by some updates from Microsoft, but annoyingly not for me.
My issue is that every time I resume my system, whilst it appears to reconnect to my WiFi, I can't do anything network-related and after a few seconds of trying I get the dreaded Limited Connectivity icon. I can usually resolve this by turning my WiFi off and on again.
A partial solution
It turns out that Client Hyper-V is probably the culprit and there is a fix. But this fix is not really satisfactory for me as it involves disabling the hypervisor and rebooting the machine. I want to be able to enable Hyper-V (it's often used when developing software) and reconnect to WiFi without any manual steps.
The fix looks like this:
To disable Hyper-V and restore Connected Standby functionality, use the following at the command line:
bcdedit /set hypervisorlaunchtype off
To re-enable Hyper-V when you need it (and thus disable Connected Standby again):
bcdedit /set hypervisorlaunchtype auto
The bad news? You need to reboot after change. The good news? It works great.
You can check it worked by running
powercfg /a from a command prompt. There are more details in Paul Thurrott's article from which the above is taken verbatim.
When I followed Paul's instructions and disabled Hyper-V I was able to reconnect to WiFi when my machine resumed. This is great, but it's just not quite right for me.
Another option along similar lines is to make a special boot menu like this one from Scott Hanselman.
There are also several other suggestions from Microsoft but these didn't work for me either.
In light of all of this and taking into account the fact that I don't want to keep disabling Hyper-V and then rebooting my machine, I decided to see if I could come up with an alternative solution.
By this stage I had noticed that on resumption from hibernation I had to disable my wireless network adapter and then re-enable it. I wondered if it might be possible to write a small Powershell script to do this and then somehow hook it up so that it was triggered automatically when I resumed my machine.
After spending about half an hour or so I got a working PowerShell script, but unfortunately it seemed to run very slowly (taking about 20 seconds to run), so I resorted to using netsh instead.
Ideally I wanted a single command so that I could invoke it from the Task Scheduler. Then I remembered that it's possible to chain several commands together by using
& like this:
cmd.exe /c "netsh interface set interface WiFi DISABLED & netsh interface set interface WiFi ENABLED"
Try running it in an Administrator Command Prompt (keyboard shortcut:
Windows-X-A) and see if it works. Watch your WiFi icon in the task bar; it should disconnect and reconnect. If it does then you are ready to hook this up to the resume from standby event.
UPDATE: 2015-10-26 - If that command doesn't work, then you should try running the following in a command prompt (which doesn't need to have administrator privileges this time):
netsh interface show interface
Check to see if your WiFi Interface Name is down as "WiFi" or "Wi-Fi" (or maybe even something completely different) and, if it's not "WiFi", adjust the command in the xml file accordingly.
RestartWiFiAdapter.xml from the GitHub repository and right-click on
install.bat and Run as administrator.
If you want to see what you just did, open the Windows Task Scheduler (I do this by pressing the
Windows key and typing "sch" and then clicking on Schedule Tasks) and choose Task Scheduler (Local) -> Task Scheduler Library in the left hand pane and find your task in the list at the top of the middle pane. Double-click on it and you should see something like this.
And that should be the end of your WiFi reconnection problems.