$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
时间: 2024-10-04 16:04:32