Working with System Restore

There are basically two WMI classes that can be used to manage system restore on a computer. These classes are SystemRestore and SystemRestoreConfig. In this section, you'll examine using both of these classes to manage system restore on both local and remote computers.

Retrieving System Restore Settings

In working with the GetSystemRestoreSettings.ps1 script, first use the param statement to permit the use of command-line arguments to the script. Define two parameters: -computer and -help. This allows you to target a remote computer and to obtain help, if required. The -computer parameter is set to a default value of localhost. This line of code is displayed here:

Param($computer = "localhost", $help)

Next, work with the ...

Get Windows PowerShell™ Scripting Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.