finding a bunch of server’s ip address

get-content server.txt| foreach {
$strComputer = $_
$colItems = get-wmiobject -class “Win32_NetworkAdapterConfiguration” `
-computername $strComputer | Where{$_.IpEnabled -Match “True”}
foreach ($objItem in $colItems) {
write-host $strComputer ” : ” $objItem.IPAddress
}
}

in the server.txt file, one server per line and no extra space at the end of each server.

Recent Entries

Leave a Reply

You must be logged in to post a comment.