Restore-Computer

在本地计算机上启动系统还原。

语法

Default (默认值)

Restore-Computer
    [-RestorePoint] <Int32>
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

说明

Restore-Computer cmdlet 将本地计算机还原到指定的系统还原点。

Restore-Computer 重新启动计算机。 还原在重启操作期间完成。

系统还原点和 Restore-Computer 仅在 Windows 7、Windows Vista 和 Windows XP 等客户端作系统上受支持。

示例

示例 1:还原本地计算机

Restore-Computer -RestorePoint 253

此命令将本地计算机还原到序列号为 253 的还原点。

示例 2:使用确认还原本地计算机

PS> 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"):

此命令将本地计算机还原到序列号为 255 的还原点。 它使用 Confirm 参数在实际执行操作之前提示用户。

示例 3:还原计算机并检查状态

Get-ComputerRestorePoint
Restore-Computer -RestorePoint 255
Get-ComputerRestorePoint -LastStatus

这些命令运行系统还原,然后检查其状态。

第一个命令使用 Get-ComputerRestorePoint 获取本地计算机上的还原点。

第二个命令将计算机还原到序列号为 255 的还原点。

第三个命令使用 cmdlet 的 Get-ComputerRestorePoint 参数来检查还原作的状态。 由于 Restore-Computer 强制重启,因此将在计算机重启后输入此命令。

参数

-Confirm

在运行 cmdlet 之前,提示你进行确认。

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:cf

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-RestorePoint

指定还原点的序列号。 若要查找序列号,请使用 Get-ComputerRestorePoint cmdlet。 此参数是必需的。

参数属性

类型:Int32
默认值:None
支持通配符:False
不显示:False
别名:SequenceNumber, SN, RP

参数集

(All)
Position:0
必需:True
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

-WhatIf

显示 cmdlet 运行时会发生什么情况。 命令脚本未运行。

参数属性

类型:SwitchParameter
默认值:False
支持通配符:False
不显示:False
别名:无线

参数集

(All)
Position:Named
必需:False
来自管道的值:False
来自管道的值(按属性名称):False
来自剩余参数的值:False

CommonParameters

此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters

输入

None

不能通过管道将输入传递给此 cmdlet。

输出

None

此 cmdlet 不生成任何输出。

备注

  • 若要在 Windows Vista 和更高版本的 Windows作系统上运行 Restore-Computer 命令,请使用“以管理员身份运行”选项打开 Windows PowerShell。
  • 此 cmdlet 使用 Windows Management Instrumentation (WMI) SystemRestore 类。