PowerShell – Getting Server IP Address Information

KB ID 0001404


I’ve been rebuilding some Hyper-V hosts over the last few weeks, and one thing I learned rebuilding VMware ESX hosts is, ‘make sure you know what all the network cards are doing before you flatten it!’

The same is true of storage as well but here I’m just concentrating on networking.

List Network Cards and MAC Addresses

If you have these documented you can rename the network card correctly after the rebuild and the mac addresses ensure you have the right names assigned to the right NICs. (Without having to go and check all the cabling afterwards!)

Get-NetAdapter | Select Name, MACAddress, vlanID

Get NIC Name and MacAddress

List Network Teams and Members

From the names of the network connections above we can see we are using network teaming, but even if yours dont have sensible names, you can get the team names and the NICs that are a member of each team with the following command;


Get Team and NIC Information

List NICs and IP addresses

To see what IP addresses are in use on which NICs, (physical or virtual) use the following;

Get-NetIPAddress -AddressState Preferred -AddressFamily IPv4 | Select Name, IPAddress, PrefixLength

Net NIC and IP Address Infomation

Hyper-V: Get vSwitch and Virtual NIC info

As stated above, I’m rebuilding Hyper-V hosts, the following lists all the Management vSwitch(es) and vNICS, (and their names).

Get-VMNetworkAdapter -ManagementOS

Hyper-V Get Management VMNICS

Hyper-V: Get vSwitch and Virtual NIC VLAN info

In addition to above, I also need to know the VLANs the vNICs are on.

Get-VMNetworkAdapterVLAN -ManagementOS

Hyper-V Get Management VMNICS VLAN

Related Articles, References, Credits, or External Links


Author: PeteLong

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *