Problems with regset

(imported topic written by GeeKman)

Hello all, I am modifying a fixlet from just checking and returning the value of a registry key to checking that its there and if it is make sure its what it is supposed to be, if not then it needs to set it.

here is what i have so far.

if ( name of operating system as lowercase starts with 
"win" ) then ( 

if ( exists size of value 
"legalnoticecaption" of keys 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\" of registry ) then ( 

if ( value 
"legalnoticecaption" of keys 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\" of registry as string = "
" ) then ( 
"Not defined" ) 

else ( 

if ( value 
"legalnoticecaption" of keys 
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\" of registry as string != "This system and all network attached devices are property of Company Name.
" ) then ( regset 
"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system]" 
"legalnoticecaption"=
"This system and all network attached devices are property of Company Name." ) 

else ( 
"some thing strange happened...." ) ) ) 

else ( 
"Not defined" ) ) 

else ( 
"N/A" )

I get an error with the relevance debuger: Error: This expression could not be parsed.

maybe im just not spotting the error.

thanks

(imported comment written by BenKus)

Hey GeeKman,

Fixlets don’t quite work this way…

Fixlets have 3 parts:

  1. Relevance – Query language to detect issue

  2. Action script – commands to fix issue.

  3. Description – HTML description of issue for users.

In this case, you have combined 1&2 into a single relevance statement, but since relevance is “query-only”, your statement gives an error.

Instead, you want to do this:

Relevance (will return “TRUE” if the situation you want is identified):

(name of operating system as lowercase starts with “win”) AND (value “legalnoticecaption” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system” of registry as string != “This system and all network attached devices are property of Company Name.”)

Action (only will be executed if relevance is “TRUE”):

regset “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system” “legalnoticecaption”=“This system and all network attached devices are property of Company Name.”

Double-check that accomplishes what you want. It looks like the syntax of the specific pieces is correct.

Ben