Sign in to follow this  
Followers 0
neevar

Creating Restore Point in Windows 8.1

7 posts in this topic

Hi everyone.

I've used autoit scripting for deploying custom applications to my workplace which awesomely sped up the time taken to set them up.

My app is made to create a restore point before anything is installed.

This worked in Windows 7 perfectly. However, now that certain number of computer systems are being ported to Windows 8.1, I wrote my app to make sure it works in Windows 8 without any hiccups.

Unfortunately, I recently discovered that no restore point is created for Windows 8.1 system.

Can someone shed some light on this?

Below is my code for the creation of the restore point

; ===== Create Restore Point - START
   $progress = $progress + $jump;
   ProgressSet($progress, "Creating Restore Point...", "Preparing");
   sleep(1000);
   $objSystemRestore = ObjGet("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
   $objSystemRestore.createrestorepoint("RPI_Restore_Point", 0, 100);

; ===== Create Restore Point - END

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It looks like the only command to start windows restore is a gui without switches. You could just save the registry files in the windows directory and restore them by copying them back. Look in C:\Windows\System32\config

Edit - Looks like in the windows 8 task scheduler there is a system restore creation event. Command line should look like this:

"%windir%system32srtasks.exe ExecuteScheduledSPPCreation"

I dont have windows 8. Try it but you should be able to shellexecute the above.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This works for me across all windows, ive not known an issue with 8 but ill double check at work today

_CreateRestorePoint('MyRestorePointName')

Func _CreateRestorePoint($sRestorePointName) ; Author = Venom007
    SplashTextOn("Restore Point", "Creating Restore Point." & @CRLF & @CRLF & _
            "Please Wait", 300, 90, -1, -1, 18)
    Local $objSystemRestore
    $objSystemRestore = ObjGet("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore")
    If Not $objSystemRestore.createrestorepoint($sRestorePointName, 0, 100) = 0 Then SetError(1)
    SplashOff()
    If Not @error Then
        SplashTextOn("System Restore", "System Restore Point Created Successfully.", 300, 45)
        Sleep(4000)
        SplashOff()
    Else
        SplashTextOn("System Restore Error", "System Restore Point Was Not Created.", 300, 45)
        Sleep(2000)
        SplashOff()
    EndIf
EndFunc   ;==>_CreateRestorePoint

Looks a little different to yours Local is declared for $objSystemRestore unless you do that elsewhere.

Like i say ill verify at work on a win 8.1 to make sure

EDIT verified as not working in WIN 8.1

Dunno how this got past me.. one more thing to fix i notice a lot of programs make restore points in Win 8.1 so it must be possible

Edited by Chimaera

Share this post


Link to post
Share on other sites

You can read in this page : http://msdn.microsoft.com/en-us/library/windows/desktop/aa378941%28v=vs.85%29.aspx, there is something specific to Windows 8.

So you can try to create the SystemRestorePointCreationFrequency value (DWORD) in HKLMSoftwareMicrosoftWindows NTCurrentVersionSystemRestore, and set its value to 0.

Not sure it's relative to your problem, but you can try...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi everyone,

thanks for the replies! Will test them out on my virtual environment later on to see the output.

Also, just a quick question: Is it possible to compile all the installer programs with the autoit script to make it a big .exe file?

My current method is to use an automatic extractor that extracts the installer files into a temp location with the script.exe and everything is read from there.

Is it possible to like just have a script.exe which does everything? Meaning all the installers are inside this script.exe and thus, remove the possibility of someone copying the installer files from the directory? 

EDIT: I've also set the files to be deleted from the temp directory after successful installation

Edited by neevar

Share this post


Link to post
Share on other sites

Had a look at the page jguinch mentioned

 

Windows 8:  

A new registry key enables application developers to change the frequency of restore-point creation.

Applications should create this key to use it because it will not preexist in the system. The following will apply by default if the key does not exist. If an application calls the CreateRestorePoint method to create a restore point, Windows skips creating this new restore point if any restore points have been created in the last 24 hours. The CreateRestorePoint method returns S_OK.

Developers can write applications that create the DWORD value SystemRestorePointCreationFrequencyunder the registry key HKLMSoftwareMicrosoftWindows NTCurrentVersionSystemRestore. The value of this registry key can change the frequency of restore point creation. The value of this registry key can change the frequency of restore point creation.

If the application calls CreateRestorePoint to create a restore point, and the registry key value is 0, system restore does not skip creating the new restore point.

If the application calls CreateRestorePoint to create a restore point, and the registry key value is the integer N, system restore skips creating a new restore point if any restore points were created in the previous N minutes.

does this mean we need to set this key to 0 before we try and create a restore point or am i missing the plot?

Share this post


Link to post
Share on other sites

Hi guys,

just an update...

I chanced upon this vbs script @ sevenforums and it worked without a problem. Link

It does create the restore point, however I see that there is a need to create that registry entry as spoken about in this thread. 

Not sure if this is the only way to make a restore point or am I better off using WinWaitActive etc to do the clicking and creation of a restore point?

Share this post


Link to post
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
Sign in to follow this  
Followers 0