FredAI Posted November 9, 2011 Share Posted November 9, 2011 (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 November 15, 2011 by FredAI masvil, obiwanceleri, youtuber and 1 other 2 2 My UDFs: SetAcl permissions | System restore Examples: File version info editor | GetIp() improved Programs: UVK - Ultra virus killer | ExeFixer | Recent file seeker | SHIcon | Quick_Any2Ico Link to comment Share on other sites More sharing options...
FredAI Posted November 10, 2011 Author Share Posted November 10, 2011 Just a simple advice: Be careful when using the _SR_Restore function. It marks the chosen system restore to be performed on reboot, and I couldn't find any documentation on how to cancel it. My UDFs: SetAcl permissions | System restore Examples: File version info editor | GetIp() improved Programs: UVK - Ultra virus killer | ExeFixer | Recent file seeker | SHIcon | Quick_Any2Ico Link to comment Share on other sites More sharing options...
BiliyomKi Posted November 11, 2011 Share Posted November 11, 2011 Thanks, its great An AutoIT user. Link to comment Share on other sites More sharing options...
ffdshow Posted May 14, 2013 Share Posted May 14, 2013 (edited) Function _SR_RemoveAllRestorePoints() doesn't work in Windows 8. Edit: Sorry, I did a syntax error. It's working fine. Edited May 14, 2013 by ffdshow Link to comment Share on other sites More sharing options...
firestrife23 Posted October 31, 2014 Share Posted October 31, 2014 (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 October 31, 2014 by firestrife23 Link to comment Share on other sites More sharing options...
MikahS Posted October 31, 2014 Share Posted October 31, 2014 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 My Snips: graphCPUTemp ~ getENVvarsMy 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 Link to comment Share on other sites More sharing options...
firestrife23 Posted October 31, 2014 Share Posted October 31, 2014 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 Link to comment Share on other sites More sharing options...
MikahS Posted November 3, 2014 Share Posted November 3, 2014 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 My Snips: graphCPUTemp ~ getENVvarsMy 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 Link to comment Share on other sites More sharing options...
hlawton Posted May 28, 2016 Share Posted May 28, 2016 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 ? Link to comment Share on other sites More sharing options...
mLipok Posted November 3, 2017 Share Posted November 3, 2017 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted November 3, 2017 Share Posted November 3, 2017 (edited) I just modified your UDF, a little No breaking Changes (I hope). SystemRestore.au3 Edited November 3, 2017 by mLipok youtuber and Earthshine 1 1 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Nunos Posted February 14, 2019 Share Posted February 14, 2019 On 11/3/2017 at 5:28 AM, mLipok said: I just modified your UDF, a little No breaking Changes (I hope). SystemRestore.au3 Creating new restore points is not working anymore. #include "SystemRestore.au3" _SR_CreateRestorePoint('New Restore Point') Running the above shows Exit Code : 0 in the console but no new restore point is created. Any idea what may have changed? Link to comment Share on other sites More sharing options...
mLipok Posted February 27, 2019 Share Posted February 27, 2019 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') 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 Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Earthshine Posted February 27, 2019 Share Posted February 27, 2019 (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 February 27, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Nunos Posted March 5, 2019 Share Posted March 5, 2019 Thanks I will see if I can find out what is wrong. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now