Failing IF statement

(imported topic written by cstoneba)

I cannot understand why my IF ENDIF test statement is failing. All it says in the log file is

ActionLogMessage: (action 3480 ) action signature verified

ActionLogMessage: (action 3480 ) ending action

Can some help?

action:

if {exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{B7EF2F7A-7F4C-44AF-943A-61FF3C6C7DEE}” of registry}

dos mkdir C:\62BREexists1

endif

Relevance:

q: if (exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{B7EF2F7A-7F4C-44AF-943A-61FF3C6C7DEE}” of registry) then “true” else “False”

A: true

(imported comment written by gjeremia91)

if {exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{B7EF2F7A-7F4C-44AF-943A-61FF3C6C7DEE}” of registry}

dos mkdir C:\62BREexists1

endif

I assume It’s the { in your key. Try using the hex value of { instead. Use the value %7b instead:

if {exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall%7bB7EF2F7A-7F4C-44AF-943A-61FF3C6C7DEE%7b” of registry}

dos mkdir C:\62BREexists1

endif

(imported comment written by cstoneba)

Now the actions succeed, but it doesn’t create the folder c:\62BREexists…

(imported comment written by sthull)

See this post for how to include curly brackets in relevance substitution:

http://forum.bigfix.com/viewtopic.php?id=2490

(imported comment written by cstoneba)

thanks sthull! If this forum had points, you’d get alot.

The final working code includes a } at the end of the GUID:

if {exists key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{B7EF2F7A-7F4C-44AF-943A-61FF3C6C7DEE}}” of registry}

dos mkdir “c:\6.2BREexists”

endif