How to create a GPO registry item without automatically replacing variables?

2

1

I created a registry item in a GPO of REG_EXPAND_SZ type with value "%userprofile%\Shares". The problem is, when the GPO is aplied, the value is created with the data "C:\Users\Default\Shares". Is there a way to mantain the value "%userprofile%\Shares" without automatically replacing the variable inside it?

Hellon

Posted 2016-07-13T03:27:34.863

Reputation: 21

Answers

0

See if this helps:

"%<userprofile>%\Shares"

w32sh

Posted 2016-07-13T03:27:34.863

Reputation: 8 611

Nice! FYI, I referred to this TechNet link.

– w32sh – 2016-07-13T16:54:09.623

0

Found the answer here https://sdmsoftware.com/forums/topic/escaping-env-variable-while-using-gpp/

You can insert <> between the variable name to prevent auto resolution, so instead of using %userprofile%, I used %<userprofile>% and it worked!

Hellon

Posted 2016-07-13T03:27:34.863

Reputation: 21