File Exists - Return "No" result back to an .htm file

by bfleming2 at 2013-01-22 08:46:24

I am looking to check for a file in Program Files for 2003 and 2008 servers which means I need it to check x86 (Program Files (x86))and x64 (Program Files)locations. And if it does not exist in either location, return that result (Server name) back to an .htm file. Easy way to do this?
by DonJ at 2013-01-22 13:43:39
Sure. The Test-Path command can check to see if a file exists.

$server = "SERVER1"
if (-not (Test-Path "\$server\C$\Program Files\Whatever\Whatever") -and -not (Test-Path "\$server\c$\Other Path")) { $server }