How to back up Local Group Policy Editor Settings on Windows

Configurare noua (How To)

Situatie

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.

Solutie

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

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

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”.

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.

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 }

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”.

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”.

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

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

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”

Then, click “Next” and “Finish”.

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

Tip solutie

Permanent

Voteaza

(2 din 4 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?