Gerard3
Contributor
Contributor

How to manage ExcludeIndividualRegistryValues when values contains backslashes

Jump to solution

Hello

I want to exclude a registry value when exporting the profile using the ExcludeIndividualRegistryValues section.

The value I don't want to keep is: "C:\Program files (x86)\Vendor\File.ext".

It contains quotation marks and backslashes...

Obviously, I can't delete the whole key because it might contain other values, and I can't use directflex (so can't perform a pre-export task to delete the value).

The log file shows :

[DEBUG] ExcludeIndividualRegistryValues: Adding exclusion for 'HKCU\Key\SubKey\SubKey I Want to export\SubKey I Need too\"C:\Program files (x86)\Vendor\File.ext"'

[DEBUG] ExportRegistry: Exporting tree 'HKCU\Key\SubKey\SubKey I Want to export'

Unfortunately, the exported registry file contains the key, its value and its data.

1 Solution

Accepted Solutions
DEMdev
VMware Employee
VMware Employee

Hi Gerard,

I don't think I ever encountered an example in the wild of a value name containing backslashes, but fortunately it is something we were aware of. Replacing the backslashes in the value name with [BACKSLASH] in your personalization config file will do the trick.

If your registry looks like this:

pastedImage_5.png

And you use the following config:

[IncludeRegistryTrees]

HKCU\Key\SubKey\SubKey Gerard wants to export

[ExcludeIndividualRegistryValues]

HKCU\Key\SubKey\SubKey Gerard wants to export\SubKey Gerard needs too\"C:[BACKSLASH]Program files (x86)[BACKSLASH]Vendor[BACKSLASH]File.ext"

The resulting .REG file will look like:

pastedImage_11.png

View solution in original post

9 Replies
ijdemes
Expert
Expert

Hi Gerard3​,

Can you show us the content of the config file? And a screenshot of what the registry (tree and values) looks like?


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com
0 Kudos
Gerard3
Contributor
Contributor

Hi Ivan

Thanks. I'm not allowed to upload files, It's blocked by my organisation.
But it's easily reproducible with dummy keys and values...

If you create and add to registry a reg file containing belloy line :

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Key\Subkey\Subkey I Want to export]

[HKEY_CURRENT_USER\Key\Subkey\Subkey I Want to export\SubKey I Need]

"Value"="123"

[HKEY_CURRENT_USER\Key\Subkey\Subkey I Want to export\SubKey I Need too]

"\"C:\\Program files (x86)\\Vendor\\File.ext\""="Data"

"Important Value to keep"="1 000 000"

you will have a value ' "C:\Program files x(86)\Vendor\File.ext" ' in the key ' SubKey I Need too '

My config file contains:

[IncludeRegistryTrees]

HKCU\Key\Subkey\Subkey I Want to export

[ExcludeIndividualRegistryValues]

HKCU\Key\Subkey\Subkey I Want to export\SubKey I Need too\"C:\Program files (x86)\Vendor\File.ext"

Gerard

0 Kudos
DEMdev
VMware Employee
VMware Employee

Hi Gerard,

I don't think I ever encountered an example in the wild of a value name containing backslashes, but fortunately it is something we were aware of. Replacing the backslashes in the value name with [BACKSLASH] in your personalization config file will do the trick.

If your registry looks like this:

pastedImage_5.png

And you use the following config:

[IncludeRegistryTrees]

HKCU\Key\SubKey\SubKey Gerard wants to export

[ExcludeIndividualRegistryValues]

HKCU\Key\SubKey\SubKey Gerard wants to export\SubKey Gerard needs too\"C:[BACKSLASH]Program files (x86)[BACKSLASH]Vendor[BACKSLASH]File.ext"

The resulting .REG file will look like:

pastedImage_11.png

View solution in original post

ijdemes
Expert
Expert

Thanks.

What happens when you replace the backslashes between the quotes with the special token [MATCHONE]?

[ExcludeIndividualRegistryValues]

HKCU\Key\Subkey\Subkey I Want to export\SubKey I Need too\"C:[MATCHONE]Program files (x86)[MATCHONE]Vendor[MATCHONE]File.ext"

Link to doc --> Wildcard Support in Exclude Section Headers


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com
0 Kudos
ijdemes
Expert
Expert

Whoops, DEMdev​ already replied. And with a better answer as well.

Wasn't aware of the [BACKSLASH] option, as it isn't something that is mentioned in the docs. But I learned from this thread, which is a good thing!


\\ Ivan
---
Twitter: @ivandemes
Blog: https://www.ivandemes.com
0 Kudos
DEMdev
VMware Employee
VMware Employee

Hi Ivan,

The use of those wildcards is restricted to folder and registry key paths; they won't work in value (or file) names. (I did have to look that up, as suggesting to use [MATCHONE] was my first thought as well Smiley Happy.)

Gerard3
Contributor
Contributor

Thanks a lot !

[MATCHONE] or [MATCHALL] are not supported in ExcludeIndividualRegistryValues section... It i's in the documentation...
[BACKSLASH] is not in the documentation and works :smileygrin:

0 Kudos
DEMdev
VMware Employee
VMware Employee

Hi Gerard,

[BACKSLASH] is not in the documentation and works :smileygrin:

Happy to hear that; thank you for reporting back. The reason it's not documented is that this is very rarely needed; you're the first to report this since we introduced [BACKSLASH] in August of 2013... Smiley Happy

0 Kudos
Gerard3
Contributor
Contributor

I agree that putting backslashes in a registry value isn't very smart...

We don't master the applications we need to virtualize...

Thanks again.