Jump to content

system restore create script


Recommended Posts

Since I could not find an autoit script to create a system restore point, I got industrious and created my own...

Sleep pauses are due to fact I could not find anything unique in the window I was waiting for.. 3 subsequent windows have the same title...

Any improvements would be appreciated very much!

Here it is: :)

;

; This script runs "System Restore" creating a restore point named "jims"

; you can change the name to yours...

; I turn system restore off so resources are not over used and then schedule

; this script each night so I have daily restore points

opt("WinTitleMatchMode", 2)

run('c:\windows\System32\restore\rstrui.exe', "", @SW_MAXIMIZE)

WinWaitActive("System Restore")

send("!e{enter}") ; send Alt+e

sleep(5000)

WinWaitActive("System Restore")

send("jims{enter}")

sleep(15000)

send("!c") ; send Alt+c

Exit

Link to comment
Share on other sites

Yes, I saw that, but since I am simple minded, I wanted something simple....

:) Mine has less lines!!!! Thanks for the info!

Nah, this is all you need:

_CreateSystemRestorePoint("My New Restore")
Func _CreateSystemRestorePoint($description,$disable = True)
    #RequireAdmin
    $obj = ObjGet("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
    $obj.Enable("")
    $obj.CreateRestorePoint($description, 12, 100)
    If $disable Then
        $obj.Disable("")
    EndIf
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...