Is there a better way to write this analysis / fixlet?

(imported topic written by SystemAdmin)

So the goal here was to right a windows only analysis / fixlet to report back the status of the Trend Officescan client. All are targeted at a Dynamic Computer which contains all Windows systems. We have to take into account x86 and x64 and we would have three possibilities for Trend - No Client, Officescan 8 or Officescan 10. Is there a better, easier, faster way of accomplishing this?

Analysis:

if (not x64 of operating system) then (if exists file “C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe” then version of file (“C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe”) as string else “No Client”) else if (x64 of operating system) then (if exists file “C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe” then version of file (“C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe”) as string else “No Client”) else “N/A”

Fixlet Relevance:

(if not x64 of operating system then (if not exists file “C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe” then True else (if version of file (“C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe”) < " then True else False)) else (if not exists file “C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe” then True else (if version of file (“C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe”) < “10.0.0.1068” then True else False)))

Fixlet Action:

// enter your action script here

download http://serverxyz:52311/Uploads/f7877ca01ac97d6b084721fcee079d4e105ff960/OfficeScanClientmsi.tmp

continue if {(size of it = 62908796 AND sha1 of it = “f7877ca01ac97d6b084721fcee079d4e105ff960”) of file “OfficeScanClientmsi.tmp” of folder “__Download”}

//uninstall Trend 8 Client

if (exists key “HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.l” whose (exists value “ProgramVer” of it AND value “ProgramVer” of it as string != “10”) of registry) then

regset "

http://HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.

" “Allow Uninstall”=dword:00000001

waithidden “C:\Program Files\Trend Micro\OfficeScan Client\ntrmv.exe”

endif

//Install Trend 10 Client

extract OfficeScanClientmsi.tmp

wait “{pathname of system folder & “\msiexec.exe”}” /i “{(pathname of client folder of current site) & “__Download\OfficeScanClient.msi”}” /qn /norestart

(imported comment written by BenKus)

Hey jspanitz,

Your relevance looks good and it is straightforward… Here is an alternate way to write the relevance using various syntax tricks, but they are no better or worse than what you have:

Property (will return if no files exist):

versions of files (“C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe”;“C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe”)

Fixlet relevance:

exists files (“C:\Program Files\Trend Micro\OfficeScan Client\PccNT.exe”;“C:\Program Files (x86)\Trend Micro\OfficeScan Client\PccNT.exe”) whose (version of it < ")

Ben

(imported comment written by SystemAdmin)

Thanks Ben. I’ve got a followup question on the action script. We are trying to build an action script that will install the Trend client if no client exists or if version 8 of the client exists. The problem is, the logic seems to just get ignored (evaluates to false?) in the action script - the regset and waithidden never execute. Is this valid logic - we know it checks out in the releveance debugger but how can we make sure it will work as action script?

//uninstall Trend 8 Client

if (exists key “HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.” whose (exists value “ProgramVer” of it AND value “ProgramVer” of it as string does not contain “10”) of registry) then

regset "

http://HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.

" “Allow Uninstall”=dword:00000001

waithidden “C:\Program Files\Trend Micro\OfficeScan Client\ntrmv.exe”

endif

(imported comment written by jessewk)

you are missing curly braces around the relevance statement in the if clause.

if {relevance}

then

do stuff

endif

(imported comment written by SystemAdmin)

OK, curly braces added and still does not execute what’s in the braces.

Any way to debug this?

(imported comment written by NoahSalzman)

Can you provide the exact script you are using so we can take a look?

(imported comment written by SystemAdmin)

Noah,

Here is the script:

download http://bigfixservergoeshere:52311/Uploads/f7877ca01ac97d6b084721fcee079d4e105ff960/OfficeScanClientmsi.tmp

continue if {(size of it = 62908796 AND sha1 of it = “f7877ca01ac97d6b084721fcee079d4e105ff960”) of file “OfficeScanClientmsi.tmp” of folder “__Download”}

//uninstall Trend 8 Client

if {(exists key “HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.” whose (exists value “ProgramVer” of it AND value “ProgramVer” of it as string does not contain “10”) of registry)} then

regset "

http://HKEY_LOCAL_MACHINE\SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc.

" “Allow Uninstall”=dword:00000001

waithidden “C:\Program Files\Trend Micro\OfficeScan Client\ntrmv.exe”

endif

//Install Trend 10 Client

extract OfficeScanClientmsi.tmp

wait “{pathname of system folder & “\msiexec.exe”}” /i “{(pathname of client folder of current site) & “__Download\OfficeScanClient.msi”}” /qn /norestart

John

(imported comment written by sstroffo91)

Remove the “then” at the end of the “if” line.

Steve