获取本地计算机上的还原点。

语法

Get-ComputerRestorePoint [[-RestorePoint] <Int32[]>] [<CommonParameters>]

Get-ComputerRestorePoint -LastStatus [<CommonParameters>]

说明

Get-ComputerRestorePoint cmdlet 获取本地计算机上的还原点。此 cmdlet 还可以显示最近的计算机还原尝试的状态。

可以使用 Get-ComputerRestorePoint 返回的信息来选择还原点,并且可以使用序列号来为 Restore-Computer cmdlet 标识还原点。

参数

-LastStatus

获取最近的系统还原操作的状态。

是否为必需?

true

位置?

named

默认值

False

是否接受管道输入?

false

是否接受通配符?

false

-RestorePoint <Int32[]>

获取具有指定的序列号的还原点。输入一个或多个还原点的序列号。默认情况下,Get-ComputerRestorePoint 将获取本地计算机上的所有还原点。

是否为必需?

false

位置?

1

默认值

All restore points

是否接受管道输入?

false

是否接受通配符?

false

<CommonParameters>

此 cmdlet 支持通用参数:-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer 和 -OutVariable。有关详细信息,请参阅 about_Commonparameters.

输入和输出

输入类型是指可通过管道传递给 cmdlet 的对象的类型。返回类型是指 Cmdlet 所返回对象的类型。

输入

None

不能通过管道将对象传递给此 cmdlet。

输出

System.Management.ManagementObject#root\default\SystemRestore 或 String。

Get-ComputerRestore 返回 SystemRestore 对象,该对象是 WMI SystemRestore 类的实例。使用 LastStatus 参数时,此 cmdlet 将返回一个字符串。

说明

要在 Windows Vista 以及 Windows 的更高版本上运行 Get-ComputerRestorePoint 命令,必须使用“以管理员身份运行”选项打开 Windows PowerShell。

此 cmdlet 使用 Windows Management Instrumentation (WMI) SystemRestore 类。

示例 1

C:\PS>get-computerrestorepoint

说明
-----------
此命令获取本地计算机上的所有还原点。






示例 2

C:\PS>get-computerrestorepoint -restorepoint 232, 240, 245

说明
-----------
此命令获取序列号为 232、240 和 245 的还原点。






示例 3

C:\PS>get-computerrestorepoint -laststatus

The last restore failed.

说明
-----------
此命令显示本地计算机上最近的系统还原操作的状态。






示例 4

C:\PS>get-computerrestorepoint | format-table SequenceNumber, @{Label="Date"; Expression={$_.ConvertToDateTime($_.CreationTime)}}, Description -auto


SequenceNumber Date                  Description
-------------- ----                  -----------
           253 8/5/2008 3:19:20 PM   Windows Update
           254 8/6/2008 1:53:24 AM   Windows Update
           255 8/7/2008 12:00:04 AM  Scheduled Checkpoint
...

说明
-----------
此命令以表的形式显示还原点以便轻松阅读。

Format-Table 命令包括一个使用 ConvertToDateTime 方法将 CreationTime 属性值由 WMI 格式转换为 DateTime 对象的计算属性。






示例 5

C:\PS>((get-computerrestorepoint)[-1]).sequencenumber

说明
-----------
此命令获取计算机上最近创建的还原点的序列号。

此命令使用 -1 索引来获取 Get-ComputerRestorePoint 返回的数组中的最后一项。






另请参阅




目录