Disable the Wi-Fi connection from command line in Windows

Get the Interface Name:

netsh interface show interface

Enable the interface:

netsh interface set interface "Interface Name" enable

Disable the interface:

netsh interface set interface "Interface Name" disable

However, we need administrator access to bring the interface up or down. You could open a command prompt in admin level to achieve this.

The runas command ensures that the command is ran as administrator, so to disable/enable the Wi-Fi would be

  C:\Windows\System32\runas.exe /user:administrator "C:\Windows\System32\netsh.exe interface set interface \"Wi-Fi\" disabled"

and then enable again

  C:\Windows\System32\runas.exe /user:administrator "C:\Windows\System32\netsh.exe interface set interface \"Wi-Fi\" enable"

The /savecred switch will save the admin password, which might be asked the first time, but usually not after that.

  C:\Windows\System32\runas.exe /savecred /user:administrator "C:\Windows\System32\netsh.exe interface set interface \"Wi-Fi\" enabled"

And if you need to remove a saved credential

rundll32.exe keymgr.dll, KRShowKeyMgr

done.

Leave a Reply

Your email address will not be published. Required fields are marked *