标签:powershell ip address 主机 users
$path="C:\Users\username\Desktop\"
$ping = New-Object system.net.networkinformation.ping
70..80 | % {$ping.send("10.0.9.$_") | select address,status} | out-file -filepath "$path ping.txt"
$IP= Get-Content "$path ping.txt" |Where-Object {$_ -match "Success"}
$IPS= -split $IP |Where-Object {$_ -like "10*"}
$hostname=foreach ($i in $IPS) { [System.Net.DNS]::GetHostByAddress($i).HostName;$i}
$hostname标签:powershell ip address 主机 users
原文地址:http://simondu.blog.51cto.com/754321/1604346