Friday, July 29, 2016

Reporting IP Addresses

Hi folks,

I would love to share with you helpful script which can be used to create report of the IP addresses configuration on Windows client or server. Of course ipconfig /all can be used. In this sense PowerShell script is very helpful as it talks to WMI and retrieves all the possible settings. Potentially they can be exported to CSV file by using Export-CSV cmdlet.

I found this this article to be extremely helpful as it covers multiple scenarios. In my cases I wanted to retrieve IP address and DNS related settings. Below is the code that I used them:

Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object IPAddress,IPSubnet,DefaultIPGateway,*DNS*

I have got the following output:


Depending on the properties you are trying to retrieve, you can tweak properties as you desire.

There are couple of comments that would love to make about the output that I have got:



"Register this connection addresses in DNS" setting in GUI corresponds to the FullDNSRegistrationEnabled

"Use this connection's DNS suffix in DNS registration" corresponds to DomainDNSRegistrationEnabled

Tick box enabled corresponds to the True in output while check box disabled corresponds to False.


Enjoy!

No comments:

Post a Comment