Enable and disable network interface in Windows
https://devblogs.microsoft.com/scripting/enabling-and-disabling-network-adapters-with-powershell/
List interfaces | |
---|---|
Get-NetAdapter | |
list only interface not UP | Get-NetAdapter | ? status -ne up |
disable | disable-NetAdapter -Name Ethernet2 |
enale | |
Powershell ESI script | |
script write-host "Welcome to my script" Get-NetAdapter Start-Sleep -Seconds 1 disable-NetAdapter -Name Ethernet2 -Confirm:$false write-host "Going to sleep" Start-Sleep -Seconds 60 write-host " " Get-NetAdapter Enable-NetAdapter -Name Ethernet2 -Confirm:$false write-host " " Get-NetAdapter write-host "The End" | |