Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #THIS SCRIPT IS UNTESTED
- $report = ""
- $servers = get-content "c:\users\$env:username\Documents\servers.txt"
- foreach ($server in $servers)
- {
- $ServerIsUP = Test-Connection -ComputerName $server -Count 3 -Quiet
- If ($ServerIsUP -eq $False)
- {
- write-host "$server is not available"
- }
- else
- {
- $addresses = [System.Net.Dns]::GetHostAddresses($server)
- foreach($a in $addresses)
- {
- $report +="{0},{1}`r`n" -f $server,$a.IPAddressToString
- }#End $Addresses Loop
- }
- $report | out-file c:\users\$env:username\Documents\lookup.txt
- }
Advertisement
Add Comment
Please, Sign In to add comment