Exists file working on server 2003 and not 2008

(imported topic written by SystemAdmin)

DISCLAIMER

I’ve been working with BigFix for just a few weeks now so my syntax may be a little bit juvenile.

DISCLAIMER

I’ve created an analysis that pulls in information about the IIS service running on the machine.

if (exists file “C:\Windows\System32\inetsrv\inetinfo.exe”) then ((version of file “C:\Windows\System32\inetsrv\inetinfo.exe”) as string) else “Does Not Exist”

For some reason the file can be detected on Windows Server 2003 machines but not Windows Server 2008 R2 x64 even though the paths to the service are the EXACT same and after manual checking the file does indeed exist. Is there a slight difference in how the “exists file” commands works for the two different operating systems?

I have tried replacing the file path with

exists file “inetinfo.exe” of folder “inetsrv” of system folder

, but that doesn’t work either. I have also ensured that the file extensions are always displayed for both environments just to be sure, but also nothing.

Any help would be appreciated.

(imported comment written by Lee Wei)

Casey,

On 64-bit windows systems, the OS actually redirects your command to a different folder.

So this will work on x64 systems.

if (exists x64 file 
"C:\Windows\System32\inetsrv\inetinfo.exe") then ((version of x64 file  
"C:\Windows\System32\inetsrv\inetinfo.exe") as string) 

else 
"Does Not Exist"

The entire statement can be.

if (x64 of operating system) then (

if (exists x64 file 
"C:\Windows\System32\inetsrv\inetinfo.exe") then ((version of x64 file  
"C:\Windows\System32\inetsrv\inetinfo.exe") as string) 

else 
"Does Not Exist") 

else (

if (exists file 
"C:\Windows\System32\inetsrv\inetinfo.exe") then ((version of file  
"C:\Windows\System32\inetsrv\inetinfo.exe") as string) 

else 
"Does Not Exist")

A different construct using the “system folder” clause is.

if (x64 of operating system) then (

if (exists file 
"inetsrv\inetinfo.exe" of system x64 folder) then ((version of file 
"inetsrv\inetinfo.exe" of system x64 folder) as string) 

else 
"Does Not Exist") 

else (

if (exists file 
"inetsrv\inetinfo.exe" of system folder) then ((version of file 
"inetsrv\inetinfo.exe" of system folder) as string) 

else 
"Does Not Exist")

Lee Wei

(imported comment written by SystemAdmin)

adding x64 to the beginning of file worked like a charm. thanks for your help.