Replace netsh with Windows PowerShell – Basic network cmdlets

Some days ago I made a blog post about how you can replace diskpart.exe with the new cmdlets in Windows PowerShell v3. Now my next goal was to replace netsh with PowerShell.

Microsoft offers a lot of new cmdlets for networking tasks lets see what we have here. We got a lot of new PowerShell modules which are related to networking.

get-module

Now the two modules which sound really interesting are

lets check which cmdlets are included

net-adpater module

Now lets start with NetAdpater.

List all Network Adapters

get-netadapter

Just list Wireless Network Adapters

get-netadapter wireless

Get more information VLAN ID, Speed, Connection status

get-netadapter information

Get driver information

get-netadapter driver

Get adapter hardware information. This can be really usefull when you need to know the PCI slot of the NIC.

get-netadapterhardwareinfo

Disable and Enable a Network Adapter

disable enable network adapter

Rename a Network Adapter

rename network adapter

Now with the NetTCPIP PowerShell module we can work with IP settings

Get IP and DNS address information

get-ipaddress

Get IP address only

get-ipaddress only

Get DNS Server Address information

get-dnsserver

Set IP Address

or if you want to change a existing IP Address

Remove IP Address

Set DNS Server

Set interface to DHCP

Now with this basic knowledge we can replace some of the basic netsh commands and ipconfig

netsh

Windows PowerShell

Related Posts: