0

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.

2
  • Login scripts don't run after hibernating. Apr 24, 2011 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, 2011 at 14:09

2 Answers 2

1

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();"'
0

@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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .