Hi - need help with the best approach to append to an existing string value if possible with regset.
if i had a key with value “hello”, I need edit that string value with a comma + string, for example "hello,goodbye"
The value could have any string so the logic would be append to any string with comma new string.
Make sense ?
Just use Relevance to build the phrase you want to store, as a Parameter first
parameter "newvalue" = "{value "MyVal" of key "HKLM\SomeKey" of Registry & ",goodbye"}"
then use the Parameter as part of your RegSet command.
regset "[HKLM\SomeKey]" "MyVal"="{parameter "newvalue"}"
awesome thank you very much
If what I posted doesn’t work for you, let me know, my console is currently loading so I can’t test the statements.
I’m getting Relevance substitution failed. Note I am escaping a curly brace.
Command failed (Relevance substitution failed) parameter “newvalue” = “{value “GroupingTags” of key “HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default” of Registry & “,Desktop_NEWVALUE”}” (action:150164)
Here’s the action
parameter “newvalue” = “{value “GroupingTags” of key “HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default” of Registry & “,Desktop_NEWVALUE”}”
regset “[HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default]” “GroupingTags”="{parameter “newvalue”}"
Don’t escape the curly braces They tell the Client to evaluate the contents as Relevance and replace it with the VALUE of the Relevance.
NEVERMIND. I Just looked at your statements.
What happens if you evaluate the clauses in QnA?
I do notice that the “\” characters appear to be missing. (Sorry, that was the Forum software removing them)
Let me do some checking and I’ll get back to you.
Are your Quotes correct? There seems to be a mix of ASCII quotes and Word Processor Quotes in your example above.
All checked.
parameter “newvalue” = “{value “GroupingTags” of key “HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default” of Registry & “,Desktop_NEWVALUE”}”
regset “[HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default]” “GroupingTags”="{parameter “newvalue”}"
Action Script Execution Detail
Failed parameter “newvalue” = “{value “GroupingTags” of key “HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default” of Registry & “,Desktop_NEWVALUE”}“
regset “[HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike{{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}{{16e0423f-7058-48c9-a204-725362b67639}\Default]” “GroupingTags”=”{parameter “newvalue”}”
What does this give you …
parameter "newvalue" = "{(value "GroupingTags" of key “HKEY_LOCAL_MACHINE\SYSTEM\CrowdStrike\{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}\{16e0423f-7058-48c9-a204-725362b67639}\Default” of Registry) as String & ",Desktop_NEWVALUE"}"
I added “as string” to ensure the value returned by the Registry Value was a String to the client.
Same issue, even if I escape the curly brace.
Sorry you have the opposite escaping of what you need…standby.
This link should help
Inside a substitution you need to escape } as }} instead, to prevent the substitution from ending early.
Is this what your looking for ? parameter "newvalue"="{ values whose (name of it is "GroupingTags") of keys "HKLM\SYSTEM\CrowdStrike\{9b03c1d9-3138-44ed-9fae-d9f4c034b88d}}\{16e0423f-7058-48c9-a204-725362b67639}}\Default" of (x32 registries; x64 registries)},DesktopNewValue"
thanks @MMosley @JasonWalker @TimRice