Restore-RegistryValue
Overview
This document explains how to restore a backed-up registry key property or registry key recursively when backed up with Backup-RegistryValue.ps1.
Requirements
- The EPM - Windows Configuration - Agnostic - Script - Backup-RegistryValue must have been used to back up the registry value.
- The script must be run with Admin Rights.
Process
- Retrieve the necessary information for the key properties (or keys and all associated properties) being restored.
- Restore the key property or key properties to their original registry location.
- Verify that the two keys match.
- If the removal of the backup is desired, remove the backup key.
 
Payload Usage
To restore the backed-up key property to its original registry location and remove the backed-up key property when finished, use the following command:
Restore-RegistryValue.ps1 -Path "HKLM:\\Software\\_automation\\WindowsUpdate\\Windowsversion" -Name Windowsversion -RemoveOnRestore
To restore the backed-up key property and all recursive keys and properties to their original registry locations, use the following command:
Restore-RegistryValue.ps1 -Path "HKLM:\\Software\\_automation\\WindowsUpdate\\Windowsversion"
Parameters
| Parameter | Alias | Required | Default | Type | Description | 
|---|---|---|---|---|---|
| -Path | True | String | The path to the backed-up registry key. | ||
| -Name | True | String | The original path of the backed-up key. | ||
| -RemoveOnRestore | False | False | Bool | Designates removal of the backed-up key after successful restore. | 
Output
Does the content write to the RMM log, a data file, or the console? If so, what is the syntax?
./Restore-RegistryValue-log.txt
./Restore-RegistryValue-error.txt
Locations
| Payload | Path | 
|---|---|
| Restore Script | /repo/script/Restore-RegistryValue.ps1 | 
| Automate | |
| ConnectWise RMM | |
| Kaseya | |
| Datto RMM |