Fri. Apr 12th, 2024


Key Takeaways

  • Backing up the Local Group Policy Editor settings is very easy. To do this, navigate to the “C:\Windows\System32\GroupPolicy” folder and copy all of the files inside it. Then, navigate to the location where you want to back up the settings, create a new folder, and paste the copied files inside it.
  • To restore your Local Group Policy Editor settings, open the folder where you backed up the settings and copy all the files inside it. Then, navigate to the “C:\Windows\System32\GroupPolicy” folder and paste the copied files into it.


Do you enjoy trying out experimental app features or Windows beta releases to stay ahead of the curve? If so, you must back up your Local Group Policy Editor settings, since this gives you the ability to hit rewind if your tinkering messes them up. Here are the different ways to do it.


Why You Should Back Up the Local Group Policy Editor Settings

The Local Group Policy Editor is a handy Windows utility that allows you to configure group policy settings on your computer. It’s mainly aimed at network administrators, but it can also be used by individuals to manage how their machine performs. You can use the Local Group Policy Editor to change password requirements, configure startup programs, define which applications and settings a user can change, and more.

Because the Local Group Policy Editor manages a wide range of necessary settings, it’s important to back it up. Doing so gives you the freedom to try out different apps, unstable Windows releases, and experimental features without worrying about losing your settings. Even if something goes wrong, you can quickly restore the Local Group Policy Editor settings to bring your computer back to a known good state.

It also means that you can transfer the settings to another machine, if you have got a new computer or want to deploy the same configuration across multiple systems.

1. Back Up Local Group Policy Editor Settings With File Explorer

The Local Group Policy Editor stores all its settings inside the System32 folder. You can quickly back up the Local Group Policy Editor settings by copying its relevant files and folders to a safe place.

To do this, press Windows+E to open File Explorer and navigate to the following location:

 C:\Windows\System32\GroupPolicy 
GroupPolicy folder in the C drive

Press Ctrl+A to select all the content of the “GroupPolicy” folder, and then press Ctrl+C to copy them. Now, go to the location where you want to store the backup. While this could be anywhere, we recommend backing it up on a separate hard drive or Google Drive. This way, the backup will remain safe even if your computer crashes completely.

Create a new folder in the location where you want to create the backup, then paste the copied content inside the newly created folder.

2. Back Up Local Group Policy Editor Settings With a Batch File

A batch file is a script file that contains a series of commands that execute automatically when you run it. You can create a batch file that will back up your Local Group Policy Editor settings.

To do this, open the Start menu, type “Notepad” in the search bar, and press Enter. In Notepad, copy-paste the following code:

 @echo off
set BACKUP_DIR=%USERPROFILE%\Desktop\Local Group Policy Editor settings backup folder
if not exist "%BACKUP_DIR%" (
md "%BACKUP_DIR%"
)
xcopy /E /I /Y "C:\Windows\System32\GroupPolicy" "%BACKUP_DIR%"
attrib -H -S "%BACKUP_DIR%"
attrib -H -S "%BACKUP_DIR%\*.*" /S /D
Back up script in Notepad

Then, click “File” in the top-left corner and choose “Save as”. Name the file whatever you wish, with “.bat” appended. Then, select “All files” from the “Save as type” drop-down menu and click “Save”.

All files option in Notepad

Now, to back up your Local Group Policy Editor settings, go to the location where you saved the batch file, right-click on it, and choose “Run as administrator”. This will create a new folder named “Local Group Policy Editor settings back up folder”, which will contain all of your settings.

Run as admin option in context menu

You will need to run the batch file again each time you change the Local Group Policy Editor settings, since the two aren’t synced.

3. Back Up Local Group Policy Editor Settings With a PowerShell Script

Backing up your local Group Policy Editor settings by running a batch file is a simple and straightforward process, but it can be easy to forget to run the batch file before resetting your computer. To avoid this, you can create a Windows PowerShell script and set up a backup task using the Task Scheduler. This way, Windows will automatically save a backup whenever you change the Local Group Policy settings.

First, start by creating a Windows PowerShell script. To do this, open Notepad and paste the following code:

 $source = 'C:\Windows\System32\GroupPolicy'
$backupFolder = "$env:USERPROFILE\Desktop\Group Policy Backup"
if (-not (Test-Path $backupFolder)) {
    New-Item -ItemType Directory -Path $backupFolder | Out-Null
}
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $source
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true
$action = {
    if ($Event.SourceEventArgs.Name -eq "GPT.ini") {
        Copy-Item -Path $source\* -Destination $backupFolder -Recurse -Force
    }
}
Register-ObjectEvent $watcher "Changed" -Action $action | Out-Null
while ($true) {
    Start-Sleep -Seconds 1
}
PowerShell script in Notepad

Then, click “File” in the top-left corner and choose “Save as”. Name the file, appending “.PS1”. Then, select “All files” from the “Save as type” drop-down menu and click “Save”.

Save option in Notepad

Now, open the Start menu, type “Task Scheduler,” and press Enter.

In the Task Scheduler window, click the “Action” tab and choose “Create Basic Task”. Type an appropriate name for the task in the “Name” field and click “Next”.

Name field in Task Scheduler

In the Trigger tab, choose “When the computer starts” and click “Next”.

When the computer starts option in Task Scheduler

In the Action tab, choose “Start a program” and click “Next”.

Start a program in Task Scheduler

In the Start a Program tab, paste the following location in the “Program/script” field:

 C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 

Type the following in the “Add arguments” field. Replace “PowerShell_Script_Address” with the location where you have saved the PowerShell script:

 -ExecutionPolicy Bypass -WindowStyle Hidden -File "PowerShell_Script_Address" 
Next option in Task Scheduler

Then, click “Next” and “Finish”.

Finish option in Task Scheduler

Now, whenever you change the Local Group Policy settings, the script runs automatically and saves the changes to the “Group Policy Backup” folder.

How to Restore the Local Group Policy Editor Settings

As mentioned above, Windows stores the Local Group Policy Editor settings in the System32 folder. Therefore, regardless of how you backed up the settings, you can restore them by simply moving the backup files to the System32 folder.

To do this, open the backup folder and copy all the files inside it. Then, navigate to the following location and paste the copied files to restore the Local Group Policy Editor settings:

 C:\Windows\System32\GroupPolicy
GroupPolicy folder in the C drive

How to Back Up and Restore the Local Group Policy Editor Settings Using LGPO

Local Group Policy Object (LGPO) is a command-line utility that you can use to automate the management of local group policy. It can export the current Local Group Policy settings to a file. This can be especially useful when you are switching to a new system and want to transfer your current device’s Local Group Policy Editor settings.

To use LGPO, visit this Microsoft page and click “Download”. Then, select “LGPO.zip” and click the “Download” button.

Download option in Microsoft Site

Once the file is downloaded, extract it somewhere on your computer. Then, open the extracted folder, copy the LGPO.exe file, and paste it in the following location:

 C:\Windows\System32 
LGPO File in File Explorer

Open the Start menu, type “Command Prompt” in the search bar, and click “Run as administrator”. Type the following command in Command Prompt and press Enter. Replace “<backup_folder_address>” with the address of the folder where you want the utility to back up the Local Group Policy Editor settings.

 LGPO.exe /b "<backup_folder_address>" 
LGPO command in Command Prompt

After that, open the backup folder, and you will see a folder with a random GUID name containing the settings. Copy the folder to a pen drive or hard drive and move it to your new computer.

GUID name folder in File Explorer

To restore local GPO settings on your new computer, open Command Prompt as administrative rights on your new computer, type the following command, and press Enter. Replace “<GUID_folder_address>” with the address where you have saved the backup folder.

 LGPO.exe /g "<GUID_folder_address>" 
Restore command in Command Prompt

Once the command is successfully executed, the Local Group Policy Editor settings will be restored on your new computer.


After following these backup methods, you can now continue using experimental features on your computer without worrying about losing your local Group Policy Editor settings.



Source link

By John P.

Leave a Reply

Your email address will not be published. Required fields are marked *