I'm trying to test for the existence of a file in 4 unc paths. Using test-path I know how to check for the existence in one unc path as such:
test-path \\networkshare\folder\file.txt
How would I go about building this out to check for the file in 4 other network paths. I've tried to create an array to store the the network paths such as:
$directories = "\\networkshare1\folder", "\\networkshare2\folder", "\\networkshare3\folder", "\\networkshare3\folder"
and assigned the file name to a variable as such:
$filename = file.txt
After that, I tried to pipeline in the filename to the $directories varialbe as such:
$directories | test-path $filename
This is not working.