February 24, 2015

IPCONFIG is all the Rage!

Often if like me you just need to get the IP Address, confirm the DG or DNS server of the machine you are working on – you can’t trust the BGINFO as things might have things have changed, so it is always better to see what they are now! Again if you  are like me you very quickly type in IPCONFIG and hit return, then you get angry at yourself as you should of typed IPCONFIG /ALL and then scrolled up and find the information.

If like me when you make these small stupid mistakes quite often, which then slows down the rate of your investigation or what ever you were doing! I would expect you will be on your way to being a little grumpy.

So these days, while Grumpy Admin here – doesn’t like extra keystrokes as you know I am lazy- I find, the following command a lot easier to get the information you want first time. So it might be faster, and it has an advantage as it is Powershell cmdlet, so you can do other stuff to it due to the pipeline. So I try to make use of the following rather than the good old IPCONFIG /ALL :- sometimes my fingers still just do the IPCONFIG /ALL but I like to think it good practice to migrate all commands over to Powershell.

Get-IPNetConfiguration

Which gives and output like this

InterfaceAlias : iSCSi2
InterfaceIndex : 13
InterfaceDescription : HP Ethernet 1Gb 4-port 366i Adapter #2
NetProfile.Name : Grid.local
IPv4Address : 192.168.21.16
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : ::1
127.0.0.1
InterfaceAlias : iSCSi1
InterfaceIndex : 14
InterfaceDescription : HP Ethernet 1Gb 4-port 366i Adapter #3
NetProfile.Name : Grid.local
IPv4Address : 192.168.20.16
IPv6DefaultGateway :
IPv4DefaultGateway :
DNSServer : ::1
127.0.0.1
InterfaceAlias : Nic Team 1
InterfaceIndex : 25
InterfaceDescription : Microsoft Network Adapter Multiplexor Driver
NetProfile.Name : Grid.local
IPv4Address : 192.168.10.14
IPv6DefaultGateway :
IPv4DefaultGateway : 192.168.10.1
DNSServer : ::1
192.168.10.30
127.0.0.1
127.0.0.1

As it is Powershell, you can use other commands down the pipeline such as FT to improve your results for more typing- for example,

Get-NetIPConfiguration | FT interfacealias,IPv4Address

as ever, don’t forget you can do a Get-Member on the Get-NetIPConfiguration command to see what other properties you could use/display. If you guys know a even quicker or better way then feel free to share!!!

Hazzy