How to Get IPaddress of List of Servers using PowerShell

Posted on: October 8, 2012

Ok , Now for me , Its time to learn PowerShell . So I started with it . Below is my First Script which will get me the IP Address information from list of servers which are specified in servers.txt file

Before running this script make sure you have stored the hostname of the servers in servers.txt and store it in C:\ Drive

Once the servers.txt is in place just run below powershell script.

Get-Wmiobject -Class win32_networkadapterconfiguration -Computername (Get-Content C:\servers.txt) | Select-Object -Property __server,IPEnabled,IPAddress | Where-Object {$_.IPEnabled -eq ‘true’} | Format-table @{l=’ServerName’;e={$_.__Server}},IPEnabled,IPAddress -autosize

Note – __server has two Underscores.

Hope this helps.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: