0% found this document useful (0 votes)
15 views1 page

Folder Check Script

The script checks if a destination folder exists on remote servers listed in a file, writes results to an output file noting if each server's folder exists or not, or if the server is unreachable.

Uploaded by

sharad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Folder Check Script

The script checks if a destination folder exists on remote servers listed in a file, writes results to an output file noting if each server's folder exists or not, or if the server is unreachable.

Uploaded by

sharad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

$computers = gc "C:\temp\server.

txt"
$destination= "c$\windows"
$File= New-Item C:\temp\foldercheck_result.txt -type file -Force

foreach ($computer in $computers)


{

if ( Test-Connection -ComputerName $computer -Count 1 -ErrorAction


SilentlyContinue )
{

if ((Test-Path -Path \\$computer\$destination))


{

write-output "$computer windows YES" | out-file $file -append

else { write-output "$computer windows NO" | out-file $file -append


}
}

else { Write-host "$computer is not on Network" }


}

You might also like