prashant1987

Archive for October 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.

Cheers,

_Prashant_

Advertisements