JonWatson Posted October 26, 2007 Share Posted October 26, 2007 Hey guys,Here at the shop, when we install windows a-fresh, the last thing we do (next to scandisk and defrag) is clearing the system restore. To do this we simply turn it off, then turn it back on again. I am in the process of automating our whole software installation/configuration procedure, and I'd like to be able to do that systemrestore thing in batch/registry.Thanks in advance for your help!Jon Link to comment Share on other sites More sharing options...
gunsmokingman Posted October 26, 2007 Share Posted October 26, 2007 Here try this VBS script. It will Disable SystemRestore wait for a minute then Enable SystemRestoreSave As Stop_Start_SR.vbs Option Explicit Dim Computer, Result, SR, Wmi Computer = "." Set Wmi = GetObject _ ("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\default")'/->Disable SystemRestore Set SR = Wmi.Get("SystemRestore") Result = SR.Disable("") '/->Stop Script For Approx 1 Minute WScript.Sleep 60000'/->Enable SystemRestore Result = SR.Enable("") Link to comment Share on other sites More sharing options...
Glenn9999 Posted October 26, 2007 Share Posted October 26, 2007 Why not disable it once you are first able and then enable it when you are done?NET STOP SRSERVICEand NET START SRSERVICE(I believe). Link to comment Share on other sites More sharing options...
JonWatson Posted October 26, 2007 Author Share Posted October 26, 2007 Wonderful, thank you both for your ideas! I don't know why I didn't think of the NET STOP solution... it's been a long day! Link to comment Share on other sites More sharing options...
Yzöwl Posted October 27, 2007 Share Posted October 27, 2007 Here try this VBS script. It will Disable SystemRestore wait for a minute then Enable SystemRestoreSave As Stop_Start_SR.vbs Option Explicit Dim Computer, Result, SR, Wmi Computer = "." Set Wmi = GetObject _ ("winmgmts:{impersonationLevel=impersonate}!\\" & Computer & "\root\default")'/->Disable SystemRestore Set SR = Wmi.Get("SystemRestore") Result = SR.Disable("") '/->Stop Script For Approx 1 Minute WScript.Sleep 60000'/->Enable SystemRestore Result = SR.Enable("")Using the WMI method you could even go one step further and create a single new one for the customer too.Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")DSRP = SRP.Disable("")ESRP = SRP.Enable("")CSRP = SRP.CreateRestorePoint ("Factory Settings", 0, 100)BTW, I don't think that the wait between disable and enable is necessary. Link to comment Share on other sites More sharing options...
VCC Posted October 27, 2007 Share Posted October 27, 2007 (edited) Hey Gunsmokinman & Yzowl,Cool feedback, I wanted to send out MY appreciation too (also to JonWatson for asking, great idea). Should be something I'll use also, automation is great. Edited October 27, 2007 by VCC Link to comment Share on other sites More sharing options...
JonWatson Posted November 14, 2007 Author Share Posted November 14, 2007 You guys rock.Here's something ironic... I sent a customer home with a new computer the other day and he installed a second hard drive with another install of windows on it (and it was screwed up a bit...). Needless to say, his new Windows installation got a bit confused (as did said customer) and things got a little messed up. So he thought he'd run System Restore and try and fix things.Well, he had rushed me to get it done far too quickly and I neglected to reset System Restore (bad idea! I've learned my lesson)... now he has bad clusters all over his restore files, and it's even worse because he restored to a point when his system was incomplete!Point being...I encourage all technicians and system builders to use the NET STOP and START method (or whichever you find easiest) and make sure that service gets reset!!!Thanks again guysJon Link to comment Share on other sites More sharing options...
gosh Posted November 14, 2007 Share Posted November 14, 2007 You both had good ideas, but there's a more efficient way to do it1 - Copy depends.exe and depends.exe from the xp or 2003 support tools and paste them into your system32 folder2 - Open depends and open srclient.dll. See screenshot belowAll of these functions can be run from the command lineexamplerundll32 srclient.dll,DisableSRThat should disable system restore. NOTE: It's case sensitive!-gosh Link to comment Share on other sites More sharing options...
JonWatson Posted November 14, 2007 Author Share Posted November 14, 2007 I don't know Gosh... I don't think you can get much more efficient than typing "net stop" and "net start"!Cool idea though Link to comment Share on other sites More sharing options...
gosh Posted November 15, 2007 Share Posted November 15, 2007 My point is net stop and net start doesn't let you customize anything. For example, let's say you want to create a restore point from the command line or change the settings. Stopping a service won't let you do that. Stopping a service to disable functionality is very crude. What if Microsoft changes system restore in a future version of windows to not delete restore points when the service is stopped?-gosh Link to comment Share on other sites More sharing options...
JonWatson Posted November 15, 2007 Author Share Posted November 15, 2007 It's true, it could be a poor way to do it in the future. However I don't foresee Microsoft making any changes like that to XP, especially after SP3 is out. Vista might be another question, but for now I'm not too worried about it. We don't really roll out a lot of Vista machines. We are based (for now) in a very... simple town, to put it nicely. It's a logging community that grew, basically. Lots of old retired lumberjacks with various missing apendages.For now, so it's not so rube goldberg, I'm using the net stop method. What we're doing is very basic, so I'm not worried.Thanks for the input though, I'll definitely keep it in mind in the future!Jon 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