Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


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



disabledisable-NetAdapter -Name Ethernet2
enale
Powershell ESI script


Code Block
titlescript
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"