Costum retrieved property not working for me

(imported topic written by Shlomi91)

Hi,

i am trying to determine which computers in my company have Pointsec installed and which version it is, so i wrote this retrieved property:

if (exists file 
"PointsecForPC.exe" of folder ((value of variable 
"ProgramFiles" of environment) & 
"\Pointsec\Pointsec for PC\PCMC\")) then ((version of file "PointsecForPC.exe
" of folder ((value of variable "ProgramFiles
" of environment) & "\Pointsec\Pointsec 

for PC\PCMC\
")) as string) else "Not Installed
"

now, on the computers that have Pointsec installed, i get the correct response. however, on computers that do not have Poinsec installed, i get .

i ran the query in Relevance Debugger and got “Singular expression refers to nonexistent object”.

can anyone ppoint out what i did wrong here?

thanks,

Shlomi

(imported comment written by sthull)

Hi Shlomi,

The problem is you are referencing a folder that may or may not exist. You can make a small change to check for the existence of the file and the folder using the whose/it syntax:

if (exists folder ((value of variable “ProgramFiles” of environment) & “\Pointsec\Pointsec for PC\PCMC”) whose (exists file “PointsecForPC.exe” of it)) then ((version of file “PointsecForPC.exe” of folder ((value of variable “ProgramFiles” of environment) & “\Pointsec\Pointsec for PC\PCMC”)) as string) else “Not Installed”

Regards,

Steve

(imported comment written by Shlomi91)

Hi sthull,

Thanks, worked great.