Analytics


Google

Tuesday, July 8, 2014

Turning on Wifi for Windows using Command line

The configuration on my notebook in the office automatically disables my wifi when I connect to our network by cable. On several occasions, the wifi dos not turn back on after I remove my PC from the docking station. I was also unable to find anything in the control panel on Windows 7 to help me do this, luckily, I found the solution from this article. The solution is shown below. An alternative way would be to right click on the network icon and click on troubleshoot problem.


Using netsh command
Get the Interface Name:
netsh interface show interface
Enable the interface:
netsh interface set interface "Interface Name" enabled
To complete the solution to your problem, you could create a shortcut, and make it run on the startup of Windows. For example, if the name of your wireless adapter in netsh is Wi-Fi, the shortcut would look like this (one line):
C:\Windows\System32\runas.exe /savecred /user:administrator "C:\Windows\System32\netsh.exe interface set interface \"Wi-Fi\" enabled"
The runas command ensures that the command is ran as administrator, which is required to bring the interface up or down. The /savecred switch will save the credentials, which might be asked the first time, but usually not after that.
Using wmc command
wmic nic get name, index
Enable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call enable
Disable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call disable