Bookmark

Donate

Subscribe

Subscribe to our RSS feed

Subscribe to our RSS feed
Email Subscription

Enter your Email ID:

Delivered by FeedBurner

Categories

Links

How to automatically create a System Restore point upon the first boot up of the day?

Published: Dec 18, 2005
Send your feedback

Introduction

Using Windows Management Instrumentation, you can manage the System Restore utility effectively. This article will explain how to automatically create a System Restore point upon the first boot up of the day.

Create a Restore point daily using this script

The script provided below will check if there are any System Restore points already created for the current day. If no System Restore point exists for the current day, the script creates a System Restore point.

To create a restore point during the first startup of the day, copy the following lines to a Notepad document, and save as a file with .VBS extension (CreateRP.VBS). Then, place the script to the Startup folder so that it runs during logon.

' 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

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
    CSRP = SRP.createrestorepoint ("Daily Restore Point", 0, 100)
End If

Related articles

Recent Posts