Automatically Create a System Restore Point

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Automatically Create a System Restore Point

Post by Marcus Tettmar » Fri Jan 20, 2006 2:41 pm

The VBScript function in this script can be used to automatically create a system restore point. Could be useful at the start of a script that makes significant changes to the system, such as at the start of an installation routine.


VBSTART
Function MakeRestorePoint
Set rp = getobject("winmgmts:\\.\root\default:Systemrestore")
msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time
If (rp.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MakeRestorePoint = msg
Else
MakeRestorePoint = "Restore Point creation Failed!"
End If
Set sr = Nothing
End Function
VBEND

VBEval>MakeRestorePoint,msg
MessageModal>msg
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts