Jump to content

SOLVED RegTweak to Disable System Restore on all but C:\ ?


drive55

Recommended Posts

`

Hi, some time ago a similar topic was posted at

http://www.msfn.org/board/lofiversion/index.php/t52848.html

and a pointer was given to a MSoft article,

but I don't understand yet how to use WMI or the script that was given.

So I'm asking a similar question again -

Would anyone have either a .reg or standalone .vbs file idea,

that would disable System Restore on all but the system partition,

in my case C:\ ( XP Pro sp2+,

yet,

not screw up the ability to enable the other partitions through the GUI ?

or the ability to disable the system partition through the GUI.

I typically have partitions D through O set up,

so if some patient, knowledgeable person would write out such a script idea -

step by step, very clearly as to what each line means - b/c I'm a script beginner,

I'd be super grateful !

It's annoying to check "Enable System Restore",

then have the MSoft way of doing things automatically enable ALL !!!! partitions,

then have to go back through a dozen+ partitions disabling them

with checkbox after checkbox.

Come to think of it, maybe tonite after dinner & cognac,

I'll browse through Ray Chen's " The Old New Thing " ,

just to see if he has a funny explanation for one more MS_pita**,

& how it just HAD to be done that way :realmad:;)

on the other hand, 2 clicks on a .reg / .vbs file & DONE would be SWEET !! :thumbup

Thank you for your time & Help ~

:D

Edited by drive55
Link to comment
Share on other sites


Assuming the last script in the thread you linked to actually works, you only have to add one condition to make it do what you want (same thing, but skipping drive C)

The old script was:

Set fso = CreateObject("Scripting.FileSystemObject")
Set lDrives = fso.drives
Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")
For Each d In lDrives
If d.DriveType = 2 Then SRP.disable(d.Path & "\")
Next

The line

If d.DriveType = 2 Then SRP.disable(d.Path & "\")

disables System Restore on all fixed drives, you just have to make it disable it on all fixed drives where the drive letter isn't C, like such:

Set fso = CreateObject("Scripting.FileSystemObject")
Set lDrives = fso.drives
Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")
For Each d In lDrives
If d.DriveType = 2 and d.DriveLetter <> "C" Then SRP.disable(d.Path & "\")
Next

Not tested (I always have that 100% disabled, and I'm just not enabling it to test that, sorry).

Link to comment
Share on other sites

:whistle: yippee !

@crahak - Thank You so much !

As MaxXP pointed out somewhere in their thread,

this works immediately, no reboot required.

I copied your script to a text file & named it SysRestore_Tweak.vbs.

Next I enabled System Restore on several non-adjacent partitions,

rebooted because I wasn't sure if it should be done just for completeness,

then clicked to execute the .vbs script.

Returned to System Restore applet & :thumbup - only C:\ was enabled.

Then I repeated the above w/o rebooting, and the results were the same success.

Now - if it's not too much to ask, WHERE the heck in Reg is this working ?

& ..... I'm currently beginning my study of J. Honeycutt's Windows Registry Guide ...

what scripting books or website should I begin to study,

in order to understand what this script says, and what it does ?

I SOOPER appreciate this 'fish', and I want to learn to fish for myself also ....

Thanks again, you've made my day & my evening (my fiance' Thanks you too) ;)

.

Link to comment
Share on other sites

You're welcome... I only added a couple words to that script, it was a 15 second job. No need for such thanks :lol:

Now - if it's not too much to ask, WHERE the heck in Reg is this working ?

As far as I know, there's 2 different locations for System Restore settings:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore\ and

HKLM\System\CurrentControlSet\Services\ + either sr & srservice (2 keys)

Never looked much into it, as I never use system restore. In my opinion it's completely useless and a unnecessary resource hog.

Either ways, a lot of system settings aren't meant to be toyed with from the registry (and sometimes it'll just overwrite changes you make in it, or won't work the same on 2 different machines -- it depends what).

Scripts make use of interfaces with the system meant precisely do make such changes (in this case, using the SystemRestore WMI class). It's more powerful and versatile, and easier to maintain than a complex reg tweak.

Scripting wise, there's a LOT of resources around. And it depends on which scripting language you're talking, and what you intend to do with it.

Edited by crahak
Link to comment
Share on other sites

The only really good documentation on system restore registry keys/values from Microsoft are here. As to what the script does, it's using the WMI namespace to access the SystemRestore classes and modify the running service via the API calls. You don't (easily) do this via the registry in XP without risking hosing the whole box, and in Vista forget it.

Stick to WMI ;) - good tool to learn to use, too.

Link to comment
Share on other sites

Stick to WMI ;) - good tool to learn to use, too.

What he said.

Things like this makes ALL the difference when it comes to admins. You have basic/junior admins who can click around Windows and do things by hand, writ simple batch files and apply some reg tweaks and such.

And then you have the good admins -- those who know all the very useful command line utils, how to script things, and how to use various technologies to make it happen (WMI, ADSI, etc). Using scripting, a good admin will apply changes on 2000+ computers faster than a "junior" admin will make them on 10.

Edited by crahak
Link to comment
Share on other sites

@cluberti - I did come across your link earlier today in my frenetic search for some answers,

& I began to get the sense that what I wanted to accomlish was not entirely suited

to be done through Registry.

Well, both your helps here are a tremendous boost for me -

I'm not even a jr.admin (yet), but your analogy is perfect, crahak.

As a "retired" health care professional,

pursuing an obsession into a possible mid-life / next-life vocation,

I totally agree,

so I shall pursue my WMI/Powershell resource studies with a vengeance now.

Man, this field can be so humbling -

I'm accustomed to turning daily miracles in the realm of carbon-based flesh,

but this silicon gated-logic arena makes me take a back row seat! ;)

Also, both your replies help me to begin to distinguish between these functions done by/in Registry,

vs.

functions accomplished @ other layers of the OS/machine.

I really look forward to understanding these as Principles,

then learning how they implement in other OS's (Linux/Mac).

:hello:

Link to comment
Share on other sites

Hi.

Based on information from this topic, I translated the vbs code to AutoIt.

This one disables system restore on all fixed drives except C:

$asDrive = DriveGetDrive("FIXED")
$objSR = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\localhost\root\default:SystemRestore")
For $i = 2 To $asDrive[0]
$objSR.Disable($asDrive[$i] & "\")
Next

This one disables System Restore on all drives:

$objSR = ObjGet("winmgmts:{ImpersonationLevel=impersonate}!\\localhost\root\default:SystemRestore")
$objSR.Disable("")

This should work for Windows XP and Windows Vista.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...