Restore-Computer
Starts a system restore on the local computer.
语法
Default (默认值)
Restore-Computer
[-RestorePoint] <Int32>
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
The Restore-Computer cmdlet restores the local computer to the specified system restore point.
Restore-Computer restarts the computer. The restore is completed during the restart operation.
System restore points and Restore-Computer are supported only on client operating systems, such as Windows 7, Windows Vista, and Windows XP.
示例
Example 1: Restore the local computer
PS C:\> Restore-Computer -RestorePoint 253
This command restores the local computer to the restore point that has sequence number 253.
Example 2: Restore the local computer with confirmation
PS C:\> Restore-Computer -RestorePoint 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"):
This command restores the local computer to the restore point that has sequence number 255. It uses the Confirm parameter to prompt the user before actually performing the operation.
Example 3: Restore a computer and check the status
PS C:\> Get-ComputerRestorePoint
PS C:\> Restore-Computer -RestorePoint 255
PS C:\> Get-ComputerRestorePoint -LastStatus
These commands run a system restore and then check its status.
The first command uses Get-ComputerRestorePoint to get the restore points on the local computer.
The second command restores 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 Restore-Computer forces a restart, this command would be entered after the computer restarts.
参数
-Confirm
Prompts you for confirmation before running the cmdlet.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | cf |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-RestorePoint
Specifies the sequence number of the restore point. To find the sequence number, use the Get-ComputerRestorePoint cmdlet. This parameter is required.
参数属性
类型: | Int32 |
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | SequenceNumber, SN, RP |
参数集
(All)
Position: | 0 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
参数属性
类型: | SwitchParameter |
默认值: | False |
支持通配符: | False |
不显示: | False |
别名: | wi |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
输入
None
You cannot pipe input to this cmdlet.
输出
None
This cmdlet does not generate any output.
备注
- To run a Restore-Computer command on Windows Vista and later versions of the Windows operating system, open Windows PowerShell by using the Run as administrator option.
- This cmdlet uses the Windows Management Instrumentation (WMI) SystemRestore class.