none
Repair Local Group Policy RRS feed

  • Question


  • Hi

    I'm trying to repair local group policy on a number of remote PCs (win 10) by deleting the file held in %windir%\system32\GroupPolicy\machine\registry.pol

    I've created a package and deployed it many times now with the same result: The file is never deleted.  The package does run as I can log various steps through the process.

    I've used psexec to run this manually as system and it works every time.

    I have added debugging lines in my code file and it appears that the deployment can't see the grouppolicy folder. After a little investigation it is a hidden folder so I tried adding 

    attrib -h %windir%\system32\GroupPolicy. (Also tried c:\windows\system32...)

    Del /q %windir%\system32\GroupPolicy/machine\registry.pol

    It just doesn't work. If I add Dir c:\windows\system32\grouppolicy > c:\test.txt

    The output is a blank system32 listing as if it can't find the folder 

    If I run the cmd file as admin it works fine.

    I've tried using RD /Q /S %windir%\system32\GroupPolicy. instead with no luck.

    Any help would be most appreciated as this is driving me nuts.

    Monday, May 22, 2017 8:53 PM

Answers

  • If you are running this as a program/package then you need to modify your code to take into account the 32-bitness of the program execution engine.

    Thus, on a 64-bit system, %windir%\system32 is being silently redirected to %windir%\syswow64.

    On a 64-bit system, you can use %windir%\sysnative to get to the real %windir%\system32 from a 32-bit process.

    More details at https://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx


    Jason | http://blog.configmgrftw.com | @jasonsandys

    • Marked as answer by Capric0rn1 Tuesday, May 23, 2017 6:12 PM
    Monday, May 22, 2017 9:32 PM

All replies

  • If you are running this as a program/package then you need to modify your code to take into account the 32-bitness of the program execution engine.

    Thus, on a 64-bit system, %windir%\system32 is being silently redirected to %windir%\syswow64.

    On a 64-bit system, you can use %windir%\sysnative to get to the real %windir%\system32 from a 32-bit process.

    More details at https://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx


    Jason | http://blog.configmgrftw.com | @jasonsandys

    • Marked as answer by Capric0rn1 Tuesday, May 23, 2017 6:12 PM
    Monday, May 22, 2017 9:32 PM
  • Doh! I never gave this a thought. Excellent reply. Many thanks for taking the trouble to respond. I'll try this tomorrow and let you know.
    Monday, May 22, 2017 9:39 PM
  • Worked a treat, thanks for saving my sanity..
    Tuesday, May 23, 2017 6:13 PM
  • OOOOOh great i did this in a previous package/program script and forgot it completely.

    Cherif Benammar

    Thursday, October 10, 2019 8:01 PM