Command/Powershell script to reset a network adapter Command/Powershell script to reset a network adapter powershell powershell

Command/Powershell script to reset a network adapter


You can use WMI from within PowerShell to accomplish this. Assuming there is a network adapter who's device name has Wireless in it, the series of commands might look something like the following:

$adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wireless*"}$adaptor.Disable()$adaptor.Enable()

Remember, if you're running this with Window's Vista, you may need to run the PowerShell as Administrator.


Zitrax's answer:

netsh interface set interface "InterfaceName" DISABLEDnetsh interface set interface "InterfaceName" ENABLED

was 99% of what I was looking for. The one piece of information that s/he left out, though, was that these commands have to be run as an administrator. Either run cmd.exe as an admin and type them in, or store them in a batch file, and then run that file as admin by right clicking on it and choosing "Run as Administrator" from the context menu.


See this article from The Scripting Guys, "How Can I Enable or Disable My Network Adapter?"

tl/dr:

Restart-NetAdapter   -Name "Your Name Here"

You can get the list using

Get-NetAdapter