none
Group Policy Object (GPO) not updating local registry settings with string %AppData%

    Question

  • Hi,

    I am using windows server 2012. I want to maintain the local registry setting value from GPO object.

    Therefore I have created an OU and tagged all machines to that OU. I created a GPO object and linked this GPO object to OU.

    I have defined a setting (HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\DocumentLocation) in the GPO object and set value “%AppData%”. To update the local registry (HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\DocumentLocation) setting values for all machines I executed “gpupdate/force” command in command prompt.

    All machine’s local registry (HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\DocumentLocation) setting is updated with value “C:\Windows\System32\config\systemprofile\AppData\Local” instead of “%AppData%”.

    How can I get “%AppData%” in all machine’s local registry (HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\DocumentLocation) setting?

    Thanks


    Wednesday, March 02, 2016 4:18 PM

Answers

  • Hi,

    It is excepted behavior. %AppData% is an environmental variable name for the application data directory. It will expand to the detail path in registry value.

    However, if you want to keep environmental variable name in registry value, please use %<AppData>% instead of %AppData% when setting up the GPO. It was tested successfully in my lab environment.

    Regards,

    Wendy


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, March 03, 2016 6:26 AM
    Moderator

All replies

  • Hi,

    It is excepted behavior. %AppData% is an environmental variable name for the application data directory. It will expand to the detail path in registry value.

    However, if you want to keep environmental variable name in registry value, please use %<AppData>% instead of %AppData% when setting up the GPO. It was tested successfully in my lab environment.

    Regards,

    Wendy


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, March 03, 2016 6:26 AM
    Moderator
  • Hi Wendy,

    Thanks for your solution and its working but "%<AppData>% " is not valid path. We can not store invalid path in GPO object. 

    We need to store valid value "%AppData%" in GPO object and want to update local registry with same string "%AppData%"

    Thanks,
    Dinesh

    Thursday, March 03, 2016 10:58 AM
  • > Thanks for your solution and its working but "%<AppData>% " is not valid
    > path. We can not store invalid path in GPO object.
     
    Seems you didn't give it a try :-)
     
    The %<AppData>% notation tells GPP to NOT resolve the variable, but
    instead write %AppData% into your registry value.
     
    Thursday, March 03, 2016 1:21 PM