/build/static/layout/Breadcrumb_cap_w.png

Need help with Verify registry pattern match

In an Online Kscript, in the Verify section of a task, I'm trying to use the Verify a registry pattern match step. If the registry key HKLM\SOFTWARE\Protector Suite exists or HKLM\SOFTWARE\Protector Suite QL exists, I want to go on and uninstall some software.

Here is the script step:
Verify that "HKLM\\SOFTWARE!=Protector Suite.*" matches.

And it succeeds on a machine where I know that registry key exists. So far, so good.

But this also succeeds:
Verify that HKLM\\SOFTWARE!=nonesuch" matches.
And there is no "nonesuch" key under HKLM\SOFTWARE.

So what is the correct syntax for using the Verify a registry pattern match to check the exists of a key that begins with "Protector Suite"? Sande

0 Comments   [ + ] Show comments

Answers (7)

Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
Again, I have a great need to get this script step working. Can anyone point me to documentation on how "Verify a registry pattern match" works?
Posted by: RichB 13 years ago
Second Degree Brown Belt
0
HKLM\\SOFTWARE!=nonesuch

I'm guessing the punctuation is wrong between the form fields. The backslash (\) is added automatically. In other words look at the result displayed above vs. what was desired "HKLM\SOFTWARE".

Also, "!=" means "does not equal" on other forms.
Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
In my first message in this thread, I was trying to pattern match against a registry key, which gets weird because in the pattern you have to escape those backslashes.

Now I'm doing something simpler, trying to pattern match against the value of a known registry entry within a known registry key. So try this:

Verify a registry pattern matches...
Key: HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
Name: ComputerName
Value: CMC019[3-5][0-9]{4}.*
Match: value

In other words, I want to check if the ComputerName entry matches the regular expression CMC019[3-5][0-9]{4}. (Check if it starts with CMC019, followed by a 5 digit number in the 30000-59999 range, optionally followed by any character.)

So here's how I'm interpreting this task step: put your regular expression to match in one of the three parts, Key, Name, or Value; change Match to indicate which part you put the pattern into; fill in the other two fields with fixed text (not patterns). Am I close?
Posted by: snissen 13 years ago
Fourth Degree Green Belt
0
(I hate having to learn KBOX stuff by trial and error...)

OK, this is working:

Verify a registry pattern matches...
Key: HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
Name: ComputerName
Value: ^CMC019[3-5][0-9]{4}.*$
Match: value

I'm hoping any valid regular expression will work; I plan to try the "Alternation construct" | later, as in: ^(CMC019|CMC110)[3-5][0-9]{4}.*$

Now, it's going to get trickier if the pattern I want to match on is part of the registry key, not the name or value, because I have to escape those backslashes in the registry key. Next time, I plan to try this:

Verify a registry pattern matches...
Key: HKLM\x5CSOFTWARE\x5CProtector Suite.*
Name:
Value:
Match: key

Any guidance along these lines would still be appreciated. Sande
Posted by: snissen 12 years ago
Fourth Degree Green Belt
0
With the new 5.3 agents, any reference to a registry entry under HKCU seems to never match to any pattern, even when the script is "Run As User logged in to console".

I though this was working with 5.1 versions of the KBOX agents for Windows.
Posted by: jverbosk 12 years ago
Red Belt
0
This doesn't answer your question directly, but I'm wondering if there in an uninstall string in the registry that you can reference - if so, you can then use "msiexec /x {....string....}" to uninstall. I've used this in my environment via a batch command in the remediation section to uninstall programs, with a "verify file exists" statement simply pointing to a file in said program's directory (if it doesn't exist, the program isn't installed), and it's worked well enough run as the logged in user.

John
Posted by: snissen 12 years ago
Fourth Degree Green Belt
0
The uninstall was just an example. I'm now trying to use the "Verify a registry pattern match" in places that have nothing to do with uninstalling. I'm disappointed that what appeared to be working with the 5.1 agents now does not work with the 5.3 agent.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ