Starts a system restore on the local computer.
Syntax
Restore-Computer [-RestorePoint] <int> [-Confirm] [-WhatIf] [<CommonParameters>]
Description
The Restore-Computer cmdlet restores the local computer to the specified system restore point.
A Restore-Computer command restarts the computer. The restore is completed during the restart operation.
Parameters
-RestorePoint <int>
Specifies the sequence number of the restore point. To find the sequence number, use Get-ComputerRestorePoint. This parameter is required.
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before executing the command.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Describes what would happen if you executed the command without actually executing the command.
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.
Inputs and Outputs
The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.
Inputs |
None You cannot pipe input to this cmdlet. |
Outputs |
None This cmdlet does not generate any output. |
Notes
To run a Restore-Computer command on Windows Vista and later versions of Windows, open Windows PowerShell with the "Run as administrator" option.
This cmdlet uses the Windows Management Instrumentation (WMI) SystemRestore class.
Example 1
C:\PS>restore-computer -RestorePoint 253 This command restores the local computer to the restore point with sequence number 253. Because the RestorePoint parameter is positional, you can omit the parameter name.
Example 2
C:\PS>restore-computer 255 -confirm Confirm Are you sure you want to perform this action? Performing operation "Restore-Computer" . [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Description ----------- This command restores the local computer to the restore point with sequence number 255. It uses the Confirm parameter to prompt the user before actually performing the operation.
Example 3
C:\PS>Get-ComputerRestorePoint C:\PS> Restore-Computer -RestorePoint 255 C:\PS> Get-ComputerRestorePoint -LastStatus These commands run a system restore and then check its status. The first command uses the Get-ComputerRestorePoint cmdlet to get the restore points on the local computer. The second command uses Restore-Computer to restore the computer to the restore point with sequence number 255. The third command uses the LastStatus parameter of Get-ComputerRestorePoint cmdlet to check the status of the restore operation. Because the Restore-Computer command forces a restart, this command would be entered when the computer restarted.
See Also