Thursday 16 April 2020

PowerShell Working on Network Adapter

Hello,


Putting together some day-to-day queries for Network Management.with PowerShell. I believe this is one of the biggest shift from using the commands like  netsh etc. But for automation of the latest

Covered basic queries and operations on the Network Interface.


Get the Network Interfaces


Get-NetAdapter



Get-NetAdapter -IncludeHidden  # Shows hidden interfaces




Get the Network Adapter Information of remote server.

Get-NetAdapter -Name "*" -CimSession "<ServerName>"




Disable Network Interface.

Disable-NetAdapter -Name "Ethernet 2"



Disable-NetAdapter on remote server.

Disable-NetAdapter -Name "E*2" -CimSession "<ServerName>"



Enable the Network Adapter

Enable-NetAdapter -Name "Ethernet 2"



Enable Network Adapter on the remote server.

Enable-NetAdapter -Name "Ethernet 2"  -CimSession "<ServerName>"


Rename Network Adapter

Rename-NetAdapter -Name Ethernet -NewName Net0




Happy Scripting!

No comments:

Post a Comment