$ping = New-Object System.Net.Networkinformation.Ping 1..10 | % {$ping.send("192.168.1.$_") } | Where-Object Status -eq "Success" | Select-Object -Property "Address" | Select -Expand Address | Out-File -FilePath "$home\Desktop\IPaddresses2.txt"