I have a script that gets a text file that has a list of PCs, pings them and exports to a csv. All this works fine
$file = Get-Content "c:\Powershell\PingPC.txt"
$Output2 = "c:\PSexport\PingOldPCs.csv"
$file | ForEach-Object {GWMI win32_pingstatus -filter ("address='"+ $_ +"'") -computername .} | Select-Object ProtocolAddress,address,responsetime,statuscode | export-csv $Output2 -NoTypeInformation
Instead of having the txt file location hard coded I would like to be able to browse to a file and pick it. I worked it down to the point where i can pick the file. It all seems to run but here is my issues
1. The exported csv only shows ping response from my local PC
It seems that it grabs the file but is only passing the file location down the pipe. I need it to read the list of PCs in the file.
I have attached what I have working so far