I am having trouble with the following script. It seems to freakout with the spaces in the file path that I am checking for. Any ideas on how to not have the PoweShell freak out, with the Program Files (x86)?
GC C:\server.txt | %{
$server = $_
if (Test-Path \\$server\c$\Program Files (x86)\some_dir\test.txt){
New-Object PSOBject -Property @{
Server = $server
Status = "Yes"
}
}else {
New-Object PSOBject -Property @{
Server = $server
Status = "No"
}
}
}| Export-Csv C:\temp\report.csv -nti