PowerShell Get-NetIPConfiguration

PowerShell 3.0’s Best Network CmdletGet-NetIPConfiguration

Get-NetIPConfiguration reminds me of IPConfig, and it shows the basic TCP/IP information much more easily than using PowerShell Gwmi classes.

Tutorial for PowerShell’s Get-NetIPConfiguration

 ♣

Basic Get-NetIPConfiguration Command

If you have ever grappled with Microsoft’s WMI network classes in PowerShell, then you may appreciate that Get-NetIPConfiguration is one of the new CIM generation of PowerShell functions.

# Assuming you have launched PowerShell 3.0 in Windows 8
Get-NetIPConfiguration

Result:

InterfaceAlias : Ethernet
InterfaceIndex : 12
InterfaceDescription : Intel(R) PRO/100 VE Network Connection
NetProfile.Name : BTBusinessHub-185
IPv4Address : 192.168.1.89
IPv6DefaultGateway :
IPv4DefaultGateway : 192.168.1.254
DNSServer : 192.168.1.254

Guy Recommends: Free WMI Monitor for PowerShellSolarwinds Free WMI Monitor for PowerShell

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft’s operating systems.  Fortunately, SolarWinds have created a Free WMI Monitor so that you can discover these gems of performance information, and thus improve your PowerShell scripts.

Take the guess work out of which WMI counters to use when scripting the operating system, Active Directory, or Exchange Server. Give this WMI monitor a try – it’s free.

Download your free copy of WMI Monitor

Gettin More Information with Get-NetIPConfiguration

Researching with Get-Help reveals two useful parameters, -Detailed and -All.  In PowerShell v 3.0 you can also work with these parameters more easily if you preface the function with Show-Command.  These switches make Get-NetIPConfiguration look even more like IPConfig on steroids.

# Research extra parameters
Get-Help Get-NetIPConfiguration

Note 1: You could substitute Show-Command for Get-Help

Get-NetIPConfiguration -Detailed

ComputerName : WIN8
InterfaceAlias : Ethernet
InterfaceIndex : 12
InterfaceDescription : Intel(R) PRO/100 VE Network Connection
NetAdapter.LinkLayerAddress : 00-13-A9-86-4F-6C
NetAdapter.Status : Up
NetProfile.Name : BTBusinessHub-185
NetProfile.NetworkCategory : Private
NetProfile.IPv6Connectivity : LocalNetwork
NetProfile.IPv4Connectivity : Internet
IPv6LinkLocalAddress : fe80::2c31:96e7:f46f:7290%12
IPv4Address : 192.168.1.89
IPv6DefaultGateway :
IPv4DefaultGateway : 192.168.1.254
NetIPv6Interface.NlMTU : 1500
NetIPv4Interface.NlMTU : 1500
NetIPv6Interface.DHCP : Enabled
NetIPv4Interface.DHCP : Enabled
DNSServer : 192.168.1.254

See IPv6 in Windows 8 »

Tuning the Output of Get-NetIPConfiguration

Appending | gm (Get-Member) lists all the properties (and methods) for a cmdlet or PowerShell function.  As a result you can modify the output to suit conditions on your computer, here is an example listing the IP addresses of all the network interfaces in a table.

Clear-Host
Get-NetIPConfiguration -all | Format-Table `
InterfaceAlias, InterfaceIndex, IPv4Address -AutoSize

Note 2: This example uses the -all parameter, thus you see the results for both real and virtual NICs.

Guy Recommends:  A Free Trial of the Network Performance Monitor (NPM)Review of Orion NPM v11.5 v11.5

SolarWinds’ Network Performance Monitor will help you discover what’s happening on your network.  This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.

What I like best is the way NPM suggests solutions to network problems.  Its also has the ability to monitor the health of individual VMware virtual machines.  If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.

Download a free trial of Solarwinds’ Network Performance Monitor

Get-NetIPConfiguration – Alias GIP

I was idly running Get-Alias, when I happened upon ‘GIP’.  The key to this discovery was deploying the -Definition parameter:
Get-Alias -Definition Get-NetIPConfiguration

Alternatively, you can examine the Alias section as revealed by Get-Help with any Cmdlet or Function.

Create Your Own Function Get-IPConfig

Another strategy is to create your own PowerShell function based on the built-in Microsoft IPConfig command.  What I did was create -IP, which display just the dotty dot numbers, for example: 192.168.1.20.

See more about creating the Get-IPConfig function »

Summary of PowerShell Get-NetIPConfiguration

PowerShell 3.0 brings a host of new functions disguised as cmdlets; NetIPConfiguration provides a really useful way of displaying information about your computer’s IP Addresses.

If you like this page then please share it with your friends

 


See more Microsoft PowerShell v 3.0 examples

PowerShell 3.0  • What’s New in PowerShell 3.0  • PowerShell v 3.0 ISE  • PowerShell Home

Get-NetAdapter  • Disable-NetAdapter  • Enable-NetAdapter  • Get-NetIPConfiguration

PowerShell Network Cmdlets  • PowerShell 3.0 Logon Script  • PowerShell Show-Command