ActiveXperts Network Monitor - Home page
Download ActiveXperts Network Monitor 7.1  (7301 KB - .exe file)
System Restore Scripts
Conduct a System Restore Create a System Restore Point Disable Full System Restore Enable Full System Restore List All Existing Restore Points List the Results of the Last System Restore List System Restore Configuration Values Modify System Restore Configuration Values
You can use any of the VBScript programs below in ActiveXperts Network Monitor.
Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.
Performs a system restore on a computer using system restore point No. 20. To perform a system restore using a different system restore point, simply change the value of the constant RESTORE_POINT.
Const RESTORE_POINT = 20
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Restore(RESTORE_POINT)
Creates a new system restore point on a computer, specifying that the restore point was created prior to installing a new device driver.
CONST DEVICE_DRIVER_INSTALL = 10
CONST BEGIN_SYSTEM_CHANGE = 100
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.CreateRestorePoint _
("Scripted restore", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)
Disables system restore on a computer. This is equivalent to selecting the checkbox Turn off System Restore (found by right-clicking My Computer, clicking Properties, and then clicking on the System Restore tab in the resulting dialog box).
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Disable("")
Enables system restore on a computer. This is equivalent to clearing the checkbox Turn off System Restore (found by right-clicking My Computer, clicking Properties, and then clicking on the System Restore tab in the resulting dialog box).
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Enable("")
Returns a list of all system restore points stored on a computer, as well as detailed information about each of those restore points.
Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set colItems = objWMIService.ExecQuery("Select * from SystemRestore")
If colItems.Count = 0 Then
WScript.Echo "No restore point in system."
Else
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Description
Wscript.Echo "Number: " & objItem.SequenceNumber
Select Case objItem.RestorePointType
Case 0 strRestoreType = "Application installation"
Case 1 strRestoreType = "Application uninstall"
Case 6 strRestoreType = "Restore"
Case 7 strRestoreType = "Checkpoint"
Case 10 strRestoreType = "Device drive installation"
Case 11 strRestoreType = "First run"
Case 12 strRestoreType = "Modify settings"
Case 13 strRestoreType = "Cancelled operation"
Case 14 strRestoreType = "Backup recovery"
Case Else strRestoreType = "Unknown"
End Select
Wscript.Echo "Restore Point Type: " & strRestoreType
dtmConvertedDate.Value = objItem.CreationTime
dtmCreationTime = dtmConvertedDate.GetVarDate
Wscript.Echo "Time: " & dtmCreationTime
Next
End If
Returns the results (failed, succeeded, interrupted) of the last system restore performed on a computer.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.GetLastRestoreStatus()
Select Case errResults
Case 0 strRestoreStatus = "The last restore failed."
Case 1 strRestoreStatus = "The last restore was successful."
Case 2 strRestoreStatus = "The last restore was interrupted."
End Select
Wscript.Echo strRestoreStatus
Displays the current system restore configuration settings on a computer.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set colItems = objWMIService.ExecQuery("Select * from SystemRestoreConfig")
For Each objItem in colItems
Wscript.Echo "Disk Percent: " & objItem.DiskPercent
Wscript.Echo "Global Interval (in seconds): " & objItem.RPGlobalInterval
Wscript.Echo "Life Interval (in seconds): " & objItem.RPLifeInterval
If objItem.RPSessionInterval = 0 Then
Wscript.Echo "Session Interval: Feature not enabled."
Else
Wscript.Echo "Session Interval (in seconds): " & _
objItem.RPSessionInterval
End If
Next
Modifies the system restore configuration values on a computer, setting the global interval to 100,000 seconds; the life interval to 8,000,000 seconds; and the session interval to 500,000 seconds.
Const GLOBAL_INTERVAL_IN_SECONDS = 100000
Const LIFE_INTERVAL_IN_SECONDS = 8000000
Const SESSION_INTERVAL_IN_SECONDS = 500000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")
Set objItem = objWMIService.Get("SystemRestoreConfig='SR'")
objItem.DiskPercent = 10
objItem.RPGlobalInterval = GLOBAL_INTERVAL_IN_SECONDS
objItem.RPLifeInterval = LIFE_INTERVAL_IN_SECONDS
objItem.RPSessionInterval = SESSION_INTERVAL_IN_SECONDS
objItem.Put_
|