Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My desktop PC has a working wireless connection. However, when I hibernate and then boot back into Windows 7 the connection is left in a broken state. I don't care about identifying the cause of this as I can always fix it by manually disconnecting and connecting again to my wireless network.

My question is - what is the easiest way for me to automate this disconnect/reconnect step so that it happens every time I boot up/log in? Ideally I would want to have a login script which slept for 30 seconds, detected the state of the wireless connection, and if it wasnt in the connected state the connection is disconnected and then connected.

share|improve this question
Login scripts don't run after hibernating. – Louis Apr 24 '11 at 13:22
Is there anything which does get run after hibernation or would I need a script that ran all the time (e.g. every minute)? – mchr Apr 24 '11 at 14:09

The easiest way I could think of has a one time setup.

  1. Run PowerShell as Administrator.
  2. Type Set-ExecutionPolicy remotesigned
  3. Confirm that you accept this policy (it means it will not run unsigned scripts that were downloaded from the internet, but will run local scripts).

Open Notepad and paste this:

Start-Process "$psHome\powershell.exe" -Verb Runas -ArgumentList '-command "$wifi = get-WMIObject -class win32_NetworkAdapter -filter "adapterTypeID=9";$wifi.disable();$wifi.enable();"'

Click File > Save as... and type a filename in quotes that has an extension of ps1. Save to your desktop. For example "Cycle WiFi.ps1" (but include the quotes).

Now whenever you have to reset your adapter just double-click the ps1 file, or single-click it if you place it in your Quick Launch.

To reset your Ethernet adapter as well, you could also do:

Start-Process "$psHome\powershell.exe" -Verb Runas -ArgumentList '-command "$wifi = get-WMIObject -class win32_NetworkAdapter -filter "adapterTypeID=9";$wifi.disable();$wifi.enable();$ethernet = get-WMIObject -class win32_NetworkAdapter -filter "adapterTypeID=0";$ethernet.disable();$ethernet.enable();"'
share|improve this answer

@Louis has a good workaround (totally stealing that framework for self-elevating) but if you want to actually fix the issue, I would start by updating your BIOS and then updating the network adapter drivers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.