Disconnect Windows network adapter through PowerShell

My network card is garbage, and until I get a new one, I need a quick fix. My idea was to ping my router, and when ping failed 3 or 4 times, it would reset the network adapter for my Wi-Fi card, however I don’t know the command line commands to do this!

I found the following in stackoverflow question:

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

However, to run this script, it must be run as administrator, and I don’t know how to fix it without running the command line manually to execute the script

+3
source share
1 answer
+5

Source: https://habr.com/ru/post/1711417/


All Articles