Skip to content

Instantly share code, notes, and snippets.

@UVLabs
Last active October 28, 2015 10:50
Show Gist options
  • Save UVLabs/95cdb97541090329766b to your computer and use it in GitHub Desktop.
Save UVLabs/95cdb97541090329766b to your computer and use it in GitHub Desktop.
auto restore point without msg boxes
If WScript.Arguments.Count = 0 Then
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ Run", , "runas", 1
Else
Set oWshShell = WScript.CreateObject("WScript.Shell")
oWshShell.Popup "Creating a SystemRestore point. Please wait.", 2, "System Restore", 0
swinmgmts = "winmgmts:\\.\root\default:Systemrestore"
GetObject(swinmgmts).CreateRestorePoint "Scheduled Restore Point", 0, 100
MsgBox "System Restore Point created", 0, "System Restore"
End If
If WScript.Arguments.Count = 0 Then
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute "wscript.exe", """" & WScript.ScriptFullName & """ Run", , "runas", 1
Else
Set oWshShell = WScript.CreateObject("WScript.Shell")
swinmgmts = "winmgmts:\\.\root\default:Systemrestore"
GetObject(swinmgmts).CreateRestorePoint "Scheduled Restore Point", 0, 100
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment