Backup and Restore Local Group Policy Settings in Windows 10  

Page 1 of 4 123 ... LastLast
    Backup and Restore Local Group Policy Settings in Windows 10

    Backup and Restore Local Group Policy Settings in Windows 10

    How to Backup and Restore Local Group Policy Settings in Windows 10
    Published by Category: Backup & Restore
    21 Aug 2023
    Designer Media Ltd

    How to Backup and Restore Local Group Policy Settings in Windows 10


    The Local Group Policy Editor (gpedit.msc) is a Microsoft Management Console (MMC) snap-in that provides a single user interface through which all the the Computer Configuration and User Configuration settings of Local Group Policy objects can be managed.

    The Local Group Policy Editor is only available in the Windows 10 Pro, Enterprise, and Education editions.

    By default, local group policy settings are saved in the three hidden folders below. This is what the downloadable .vbs files below will automatically backup and restore for you.

    (Computer Configuration)
    %SystemRoot%\System32\GroupPolicy\Machine

    (User Configuration)
    %SystemRoot%\System32\GroupPolicy\User

    (User/Group Specific GPOs Configuration)
    %SystemRoot%\System32\GroupPolicyUsers

    This tutorial will show you how to backup and restore Local Group Policy settings on any Windows 10 Pro, Enterprise, or Education PC.

    You must be signed in as an administrator to back up and restore Local Group Policy Editor settings.

    This will not include Local Security Policy settings.



    Contents

    • Option One: To Backup Local Group Policy Editor Objects from a PC
    • Option Two: To Restore Local Group Policy Editor Objects to a PC



    EXAMPLE: Local Group Policy Editor
    Backup and Restore Local Group Policy Settings in Windows 10-local_group_policy_editor.png






    OPTION ONE

    Open Local Group Policy Editor Objects in Run


    1 Click/tap on the Download button below to download the .vbs file below.

    Backup_Local_Group_Policy.vbs

    Download

    Contents of .vbs file for reference.

    Code:
    If WScript.Arguments.length =0 Then
              
    Set objShell = CreateObject("Shell.Application")
    objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 
    
    Else 
    Set oShell = WScript.CreateObject ("WScript.Shell")
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %SystemRoot%\System32\GroupPolicy\Machine %userprofile%\Desktop\Local-Group-Policy-Backup\Machine"),0
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %SystemRoot%\System32\GroupPolicy\User %userprofile%\Desktop\Local-Group-Policy-Backup\User"),0
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %SystemRoot%\System32\GroupPolicyUsers %userprofile%\Desktop\Local-Group-Policy-Backup\GroupPolicyUsers"),0
    
    End If

    2 Save the .vbs file to your desktop.

    3 Unblock the .vbs file, and run the .vbs file.

    4 Click/tap on Yes when prompted by UAC.

    5 You will now have a Local-Group-Policy-Backup folder on your desktop that is the backup of the local group policies on this PC.

    6 Move this folder to where you like for safe keeping.

    Do not rename this folder since it must remain the exact same name to be able to use it in OPTION TWO below to restore.







    OPTION TWO

    To Restore Local Group Policy Editor Objects to a PC


    1 Move or copy the Local-Group-Policy-Backup folder created from OPTION ONE above to your desktop.

    2 Click/tap on the Download button below to download the .vbs file below.

    Restore_Local_Group_Policy.vbs

    Download

    Contents of .vbs file for reference.

    Code:
    If WScript.Arguments.length =0 Then
              
    Set objShell = CreateObject("Shell.Application")
    objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1 
    
    Else 
    Set oShell = WScript.CreateObject ("WScript.Shell")
    
    oShell.run ("cmd.exe /c RD /S /Q %SystemRoot%\System32\GroupPolicy\Machine"),0
    
    oShell.run ("cmd.exe /c RD /S /Q %SystemRoot%\System32\GroupPolicy\User"),0
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %userprofile%\Desktop\Local-Group-Policy-Backup\Machine %SystemRoot%\System32\GroupPolicy\Machine"),0
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %userprofile%\Desktop\Local-Group-Policy-Backup\User %SystemRoot%\System32\GroupPolicy\User"),0
    
    oShell.run ("cmd.exe /c xcopy /c /e /h /i /q /y %userprofile%\Desktop\Local-Group-Policy-Backup\GroupPolicyUsers %SystemRoot%\System32\GroupPolicyUsers"),0
    
    WScript.Sleep 2000
    
    oShell.run "cmd.exe /k gpupdate /force"
    
    End If

    3 Save the .vbs file to your desktop.

    4 Unblock the .vbs file, and run the .vbs file.

    5 Click/tap on Yes when prompted by UAC.

    6 When both Computer policy and User policy update has completed successfully, you can close the command prompt. (see screenshot below)

    Backup and Restore Local Group Policy Settings in Windows 10-updating_policy.jpg


    That's it,
    Shawn Brink






  1. Posts : 86
    Windows 10 64bit
       #1

    The script is interesting. I was reviewing the script and wondered what the ' ' SIG blah blah ' ' was for. I found through some reading that the vbscript is digitally signed, Is there a reason for this? What certificate is the script signed as? Why doesn't the script verify that it is signed?


    Sorry about all these questions but I'm just interested to know. Thanks,

    PS: I review each script and registry file.
      My Computer


  2. Posts : 68,652
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Hello Jerry, :)

    That's correct. It's the digital signature for the .vbs file so folks won't possibly get the default "unknown publisher possible dangerous file" warning when downloading.
      My Computers


  3. Posts : 11
    Windows 10
       #3

    backup the group policies on one machine and restore them to the other machines? So I can be sure that the group policies are consistent across the machines? in other words all group policies have the same settings in all machines.
      My Computer


  4. Posts : 68,652
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    Hello BC66, :)

    Yes, that would be correct as long as the PCs are running Windows 10 Pro, Enterprise, or Education to have the Local Group Policy Editor.
      My Computers


  5. Posts : 1
    Windows 10 Enterprise
       #5

    Hi Brink.

    I followed your instructions for the first option and downloaded the .vbs file to my Desktop folder. The file wasn't blocked so that was a non-issue, but there was no option to run the file when I right-clicked on it - only to open it. When I did that UAC asked me if I wanted Microsoft Windows Based Script Host to make changes to my device. I clicked on Yes and all that happened was that a Local Group Policy folder was placed in my Desktop folder next to the original .vbs file. The Group Policy Folder contained three other folders - GroupPolicyUsers, Machine, and User. All 3 folders were empty and contained no backups.

    Any thoughts or suggestions? Thank you kindly.
      My Computer


  6. Posts : 68,652
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    Hello Ring, and welcome to Ten Forums. :)

    It sounds like the .vbs file successfully ran (opened).

    The backup folder would only contain backups of policies set via the Local Group Policy Editor. Double check using the tutorial below to see if you have any set.

    See Applied Group Policies in Windows 10 General Tips Tutorials
      My Computers


  7. Posts : 11
    Windows 10
       #7

    Hi Shawn

    I followed the instructions, unblock, run, or open the file, but when I do so, no folders are created on the desktop.
    Any thoughts?
    Running Win 10 enterprise.

    Thx
      My Computer


  8. Posts : 68,652
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Terra99 said:
    Hi Shawn

    I followed the instructions, unblock, run, or open the file, but when I do so, no folders are created on the desktop.
    Any thoughts?
    Running Win 10 enterprise.

    Thx
    Hello Terra,

    If you haven't already, you might see if refreshing (F5) your desktop may help to see the folder if created.
      My Computers


  9. Posts : 11
    Windows 10
       #9

    already tried that, and no joy
      My Computer


 

Tutorial Categories

Backup and Restore Local Group Policy Settings in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:58.
Find Us




Windows 10 Forums