Enable ComputerRestore - PowerShell
Overview
Enable-ComputerRestore empowers you to activate the System Restore feature on a specified computer, enabling the restoration of the system to a previous state in case of unexpected events. System Restore creates restore points at specific intervals or before significant system changes, allowing you to revert to a stable configuration if necessary.
Syntax
Enable-ComputerRestore [-ComputerName] <String[]> [-IncludeSystemDrive] -[-ExcludeDisks] <String[]>
Options/Flags
-ComputerName
: Specifies the target computer(s) to enable System Restore on. Can be a hostname, IP address, or localhost.-IncludeSystemDrive
: Includes the system drive in the System Restore configuration. By default, it is excluded.-ExcludeDisks
: Excludes specified disk(s) from the System Restore configuration. Disks must be specified by their drive letters (e.g., -ExcludeDisks C: D:).
Examples
Example 1: Enable System Restore on a Local Computer
Enable-ComputerRestore
Example 2: Enable System Restore for Multiple Computers
Enable-ComputerRestore -ComputerName Server1 Server2
Example 3: Exclude the System Drive from System Restore
Enable-ComputerRestore -IncludeSystemDrive
Example 4: Exclude Specific Disks from System Restore
Enable-ComputerRestore -ExcludeDisks E: F:
Common Issues
- Permission Denied: Ensure you have sufficient administrative privileges on the target computer(s).
- System Restore Service Not Running: Verify that the System Restore service is started on the target computer(s).
Integration
Script Example: Enable System Restore on Multiple Servers
$servers = Get-Content servers.txt
foreach ($server in $servers) {
Enable-ComputerRestore -ComputerName $server
}
Related Commands
- Disable-ComputerRestore: Disables System Restore on a specified computer.
- Checkpoint-Computer: Creates a restore point on the local or remote computer.
- Restore-Computer: Restores the system to a previous restore point.