Creating a System Restore Point on Windows 7

This page has not been liked. Updated 11/26/13, 8:12 PM by BigFixNinjaTags: None

The following code can be used to create a system restore point on a Windows machine ahead of patching:

 

' Create a System Restore Point
 
CONST DESCRIPTION = "IEM Patch Install"
CONST APPLICATION_INSTALL = 0
CONST BEGIN_SYSTEM_CHANGE = 100
 
strComputer = "." ' Local computer
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
 
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.CreateRestorePoint(DESCRIPTION, APPLICATION_INSTALL, BEGIN_SYSTEM_CHANGE) 
WScript.Quit(errResults) 
 

 

Click here for a task that can be imported into the console and action-ed on to create this system restore point on a Windows 7 machine.

Note: You will also Also check out CreateRestorePoint method of the SystemRestore class to understand the two numeric parameters that are passed to the CreateRestorePoint() function.