Kaseya Community

System Restore Script

  • Hello guys, has anyone created a procedure to create a system restore? According to Microsoft, system restore is supposed to create a restore point everyday but that does not happen, a restore point only gets created when a new software is installed or new patches.

  • VBScript to create a restore point:

    set SRP = getobject("winmgmts:\\.\root\default:Systemrestore")
    CSRP = SRP.createrestorepoint ("this is a test", 0, 100)

    
    

     

  • Or more elaborate, with command line argument for restore point name, and failure checking:

    Set Args = wscript.Arguments
    If Args.Count() > 0 Then
    	RpName = Args.item(0)
    Else 
    	RpName = "Vbscript"
    End If
    
    Set obj = GetObject("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
    
    If (obj.CreateRestorePoint(RpName, 0, 100)) = 0 Then
    	wscript.Echo "Success"
    Else 
    	wscript.Echo "Failed"
    End If

  • Hello Dan, thanks for the script. When I try to import it and paste the code into body I get this error: ■The text you are trying to import is ot a valid XML or ASP import format.

    ■Index was outside the bounds of the array.

  • Procedure Create system restore point - beta.xml

    That wasn't a Kaseya script I pasted, that's why.

    Here's a Kaseya Agent Procedure you can try.  I tested this on my Windows7 box, but have not tested it on any other Windows version.

    It's attached to this post.

     

  • Update: tested on XP SP3 and it works as well

    I've also uploaded this to the Resources section

  • Thank You very much Dan! That procedure works great.

  • Nice procedure Dan.  Particularly like the way you create the VBS.  Clever.  Me likes.

    One for the resources page I reckon.

  • Thanks! Hopefully people can get use out of it.  I did add it to the Resources area of the site.

    For smaller vbscripts, I like to generate on the fly like that because it's so much easier than using a 'get file'.  Much easier to make changes to the script as well.