VMware Horizon Community
Gerard3
Contributor
Contributor
Jump to solution

How to manage ExcludeIndividualRegistryValues when values contains backslashes

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
Jump to solution

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
Jump to solution

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
Reply
0 Kudos
Gerard3
Contributor
Contributor
Jump to solution

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

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

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

ijdemes
Expert
Expert
Jump to solution

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
Reply
0 Kudos
ijdemes
Expert
Expert
Jump to solution

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
Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

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
Jump to solution

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:

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

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

Reply
0 Kudos
Gerard3
Contributor
Contributor
Jump to solution

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.