DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: SOLVED: Script to set a system restore point; win7  (Read 13,518 times)

benhenry

  • Howdy
  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 4
SOLVED: Script to set a system restore point; win7
« on: July 14, 2010, 08:41 PM »
This is my first visit here... what a groovy place!

I got two vb scripts that set a system restore point in win7 (from a place called "lifehacker")

The first one sets the restore point with a label that is supplied from a message box:

If WScript.Arguments.Count = 0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1
Else
GetObject("winmgmts:\\.\root\default:Systemrestore").CreateRestorePoint InputBox("Enter a descriptive name for the restore point:","Create Restore Point - With Description"), 0, 100
End If


The second one sets the restore point with a preset label, in this case, "manual restore point":

If WScript.Arguments.Count = 0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " Run", , "runas", 1
Else
GetObject("winmgmts:\\.\root\default:Systemrestore").CreateRestorePoint "Manual Restore Point", 0, 100
End If


Is there a way to combine these two so that if I "cancel" the message box on the first one...
without typing a label; it will simply run the other one to create the restore point with the preset label?

Thanks if you can help.. Ben

-benhenry

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • Coding Snacks
Re: IDEA: Script to set a system restore point; win7
« Reply #1 on: July 14, 2010, 11:58 PM »
This one looks like it has the bases covered:

http://www.winhelponline.com/blog/wp-content/uploads/createsrp.vbs

edit: btw if you want a different default string, just change "Manual Restore Point" to "my default string".  This way you can still back out by pressing Cancel.
« Last Edit: July 15, 2010, 12:12 AM by MilesAhead »

benhenry

  • Howdy
  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 4
Re: IDEA: Script to set a system restore point; win7
« Reply #2 on: July 15, 2010, 12:32 AM »
Thank you! Works perfectly. I'm a single parent with teenagers.
System restore points are a necessity.
-benhenry

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: IDEA: Script to set a system restore point; win7
« Reply #3 on: July 15, 2010, 12:36 AM »
Quote
I'm a single parent with teenagers.
System restore points are a necessity.

;D ;D ;D

setting up a good external backup system would probably be a good idea too.

parkint

  • It's bad luck to be superstitious
  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 119
Re: IDEA: Script to set a system restore point; win7
« Reply #4 on: July 15, 2010, 01:47 AM »
This one looks like it has the bases covered:

http://www.winhelponline.com/blog/wp-content/uploads/createsrp.vbs
Wonderful goodness.

Original address: https://www.donationcoder.com/forum/index.php?topic=23415.0