Jump to content

Recommended Posts

Posted (edited)

Hi.

I needed this for one of my apps, and all I could find here was a WMI object function to create a restore point, so I decided to create this UDF and post it here.

It has functions to enumerate, delete (one or all) and create restore points.

Also enable or disable the system restore, and restore the system to one of the restore points.

There are only two functions available through DllCall on msdn, the others are WMI.

The UDF is not commented yet, I'll do it tomorrow and update. It's getting late, now. Better call it a night.

Sorry for the delay. Here's the commented updated version: (28 downloads before)

Note: Some functions were slightly modified.

Updated 15/11/2011 (66 total downloads). The $DriveL optional parameter in the _SR_Enable and _SR_Disable functions must be in the format $SystemDrive & '\', or the functions won't work.

SystemRestore.au3

Edited by FredAI
  • 1 year later...
Posted (edited)

Function _SR_RemoveAllRestorePoints() doesn't work in Windows 8.

Edit: Sorry, I did a syntax error. It's working fine.

Edited by ffdshow
  • 1 year later...
Posted (edited)

I tried this syntax _SR_CreateRestorePoint('Test Restore Point') but it doesn't work?

This is snippet of code I tried

#include <SystemRestore.au3>

_SR_CreateRestorePoint('Test Restore Point')

If @error = 0 Then
   MsgBox(0 + 64 + 262144, "Error", "Failed to create System Restore Point!")
Else
   MsgBox(0 + 64 + 262144, "System Message", "System Restore Point created successfully.", 5)
EndIf
Edited by firestrife23
Posted

Remarks .......: The system restore takes a few seconds to update.

try

#include <SystemRestore.au3>
 
_SR_CreateRestorePoint('Test Restore Point')
 
Sleep(3000)
 

If @error = 0 Then
   MsgBox(0 + 64 + 262144, "Error", "Failed to create System Restore Point!")
Else
   MsgBox(0 + 64 + 262144, "System Message", "System Restore Point created successfully.", 5)
EndIf

Snips & Scripts

  Reveal hidden contents

My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Posted

MikahS,

Thank you for your suggestion but no luck so far... here's my another attempt, this time it come back as success.... however, when you run rstrui.exe to verify and it's not there as if it never got created in first place....

#include <MsgBoxConstants.au3>
#include <SystemRestore.au3>

CreateRestorePoint()

Func CreateRestorePoint()
   Local $pid = _SR_CreateRestorePoint('Test Restore Point')
   Do
      Sleep(3000)
   Until $pid = 0 or $pid = 1
   If $pid = 0 Then
      MsgBox(0 + 64 + 262144, "Error", "Failed to create System Restore Point!")
   ElseIf $pid = 1 Then
      MsgBox(0 + 64 + 262144, "System Message", "System Restore Point created successfully.", 5)
   EndIf
EndFunc
Posted
  On 10/31/2014 at 7:45 PM, firestrife23 said:

 

MikahS,

Thank you for your suggestion but no luck so far... here's my another attempt, this time it come back as success.... however, when you run rstrui.exe to verify and it's not there as if it never got created in first place....

 

Hmm, I think I would have to delve deep into the UDF or hopefully the author can shed some light on the subject (last active in july though :( )

Snips & Scripts

  Reveal hidden contents

My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

  • 1 year later...
Posted

Hi,

Thanks for the code ... Tried it in Win PE 7 with all the services running like VSS and such ... when i called the _SR_Enable("C:\") function it returned 0 ...

i also been trying to get it to enable in powershell and it fails there too saying it not system drive (but it is for sure) ...

I can get recenv.exe to do a computer restore point so i figured WMI would do it or PS ...

Any ideas on why it failing ?

 

  • 1 year later...
Posted

Please change:
_WMIDateStringToDate
to
__SR_WMIDateStringToDate

to be coherent with other function names and because this is internal function.

btw.
I modified it a little (to be more HumanReadabled) :
 

Func __SR_WMIDateStringToDate($dtmDate)
    Return _
            (StringMid($dtmDate, 5, 2) & "/" & _
            StringMid($dtmDate, 7, 2) & "/" & _
            StringLeft($dtmDate, 4)  & " " & _
            StringMid($dtmDate, 9, 2) & ":" & _
            StringMid($dtmDate, 11, 2) & ":" & _
            StringMid($dtmDate, 13, 2))
EndFunc   ;==>__SR_WMIDateStringToDate

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

I just modified your UDF, a little ;)

No breaking Changes (I hope).

SystemRestore.au3Fetching info...

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

  • 1 year later...
  • 2 weeks later...
Posted

It is realeated to your system, as I have no problem (on my Win10Pro 64Bit) with this snippet:

#include "SystemRestore.au3"
_SR_CreateRestorePoint('New Restore Point - AUTOIT')

image.png.10d8c72a49050d108ce162478b4018c5.png

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

can also do it with command line

Wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "%DATE%", 100, 1

or 

Wmic.exe /Namespace:\\root\default Path SystemRestore Call CreateRestorePoint "%DATE%", 100, 1

as spelled out here.

https://www.winhelponline.com/blog/create-system-restore-point-script-windows-10-8-7-vista-xp/

 

powershell as well

https://www.winhelponline.com/blog/create-system-restore-point-script-windows-10-8-7-vista-xp/#powershell

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

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
  • Recently Browsing   0 members

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