youtuber Posted March 24, 2019 Posted March 24, 2019 https://docs.microsoft.com/en-us/windows/desktop/sr/getlastrestorestatus-systemrestore Here is an article to find out whether the restore point is open or closed, but this autoit doesn't return any value #RequireAdmin $obj = ObjGet("winmgmts:{impersonationLevel=impersonate}!root/default:SystemRestore") $obj.GetLastRestoreStatus() MsgBox(0, "", $obj) If $obj = 0 Then MsgBox(0, "", "Failed") ElseIf $obj = 1 Then MsgBox(0, "", "Success") ElseIf $obj = 2 Then MsgBox(0, "", "Interrrupted") EndIf
Developers Jos Posted March 24, 2019 Developers Posted March 24, 2019 There is no error checking in there for COM Error Handling plus there are several things wrong in your script. Maybe an idea to do yourself the next time before posting a question here? This version seem to work: #RequireAdmin $obj = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\default") $objItem = $obj.Get("SystemRestore") $lastStatus = $objItem.GetLastRestoreStatus() ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $lastStatus = ' & $lastStatus & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console If $lastStatus = 0 Then MsgBox(0, "", "Failed") ElseIf $lastStatus = 1 Then MsgBox(0, "", "Success") ElseIf $lastStatus = 2 Then MsgBox(0, "", "Interrrupted") EndIf Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
youtuber Posted March 24, 2019 Author Posted March 24, 2019 system protection always shows 0, whether open or not https://prnt.sc/n2909u https://prnt.sc/n29169
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