' Creates a SR point during the first startup of the day ' December 18, 2005 ' For Windows® XP ' © 2005 Ramesh Srinivasan ' Website: http://windowsxp.mvps.org ' ---------------------------------------------------------------------------- ' -- $Id: //depot/Platform/Windows/Program Files/Utils/Create_System_Restore_Point.vbs#1 $ ' -- $Change: 73 $ ' -- $DateTime: 2009/03/14 08:51:38 $ ' -- $Author: pt $ ' ---------------------------------------------------------------------------- Option Explicit Dim SRP, CSRP, objWMI, clsPoint Dim RPDate, D1, D2, dtmInstallDate, DMatch DMatch = 0 Set SRP = getobject("winmgmts:\\.\root\default:Systemrestore") Set dtmInstallDate = CreateObject("WbemScripting.SWbemDateTime") Set objWMI = getobject( _ "winmgmts:\\.\root\default").InstancesOf ("systemrestore") For Each clsPoint In objWMI RPDate = getmytime(clsPoint.creationtime) D1 = Month(RPDate) & "/" & Day(RPDate) & "/" & Year(RPDate) D2 = Month(Date) & "/" & Day(Date) & "/" & Year(Date) If D1 = D2 Then DMatch = 1 Next Function getmytime(wmitime) dtmInstallDate.Value = wmitime getmytime = dtmInstallDate.GetVarDate end Function If DMatch = 0 Then Wscript.echo "Create daily system restore checkpoint" CSRP = SRP.createrestorepoint ("Daily system restore checkpoint", 0, 100) Else Wscript.echo "Create manual system restore checkpoint" CSRP = SRP.createrestorepoint ("Manually created system restore checkpoint", 0, 100) End If ' from http://support.microsoft.com/?kbid=295299 'use WMI moniker and SystemRestore class ' set SRP = getobject("winmgmts:\\.\root\default:Systemrestore") ' CSRP = SRP.createrestorepoint ("Manually created restore point", 0, 100)