VBscript - Set System Restore settings Win 7

Posted on 2011-09-26
Medium Priority
Last Modified: 2012-05-12
Does anyone know of or can create a script that can be deployed using group policy to turn on system restore on a data partition (eg. D: ) for Windows 7 computers? What I would like is to to turn on System Restore on the data partition to "Only restore previous versions of files" and use up 5% of disk space.

Thanks guys!

Question by:Ivano Viola
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
LVL 65

Expert Comment

ID: 36694462
Hi, this will show you how to configure System Restore:

Down the bottom there's code to change the configuration of it.


LVL 21

Author Comment

by:Ivano Viola
ID: 36712672

I did come across that site you posted the other day. It doesn't really tell me how to turn on System Restore and set it to "Only restore previous versions of files".

LVL 65

Accepted Solution

RobSampson earned 2000 total points
ID: 36714012
OK, well this will enable system restore on drive D and set it to use 5 percent.   As yet, I haven't found a way to select "Only restore previous versions of files" and from what I've read you can't change that programatically.

I'm still looking around at possible registry changes....

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")

Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.Enable("D:")

Set objConfig = objWMIService.Get("SystemRestoreConfig='SR'")
objConfig.DiskPercent = 5

Open in new window


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 65

Expert Comment

ID: 36714077
OK, test this too, but please back up the following registry key first:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients\

by right clicking that key and selecting Export.

Then within that key, you should see a REG_MULTI_SZ value with a name of

Delete that value, and check your System Restore settings again.  It worked for me.  Then, when I added the backed up registry values back in, the setting for "Restore system settings and previous versions of files" was selected again.

The tricky part would be knowing what to add back into that if you wanted to enable it again.  You might just get away with disabling, then re-enabling system restore, but I haven't tried that.


LVL 21

Author Closing Comment

by:Ivano Viola
ID: 36817347
The reg key didn't work but that's fine. Not sure why they don't add more settings for System Restore in group policy. You can pretty much just turn it off or on. Not much on the Internet regarding "Only restore previous versions of files".

I appreciate the help. Thanks again!

LVL 65

Expert Comment

ID: 36818657
OK, thanks for the grade anyway.  It would be nice if they allowed more scriptable configuration, though!


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question