Jump to content

turn off system restore on all drives except C:


Recommended Posts


Try using this VB script that another forum member here graciously helped me out with...

Dim SRP, eSRP
Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")
eSRP = SRP.disable("D:\")

Replace "D:\" with whatever drive you wish to disable system restore on (you must also keep the quotes).

You can also re-enable it by changing SRP.disable to SRP.enable

You can't use this during the actual installation process, but you can use it during GUIRUNONCE/EX.

Just copy+paste it into notepad and save it with the .vbs extension (making sure not to save it as .vbs.txt)

:)

Link to comment
Share on other sites

Or to search through all and turn off except C

Save this as

SysRestoreOff.vbs

Const DriveTypeRemovable = 1
Const DriveTypeFixed = 2
Const DriveTypeNetwork = 3
Const DriveTypeCDROM = 4
Const DriveTypeRAMDisk = 5

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Drives = FSO.Drives
For each Drive in Drives
If Drive.DriveType = 2 then
 If Drive = "C:" then
 Else
 Target Drive
 End if
End if
Next

Sub Target(Drive)
 Dim SRP, eSRP
 Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")
 eSRP = SRP.disable(Drive & "\")
 Set SRP = Nothing
 Set eSRP = Nothing
End Sub

Set FSO = Nothing
Set Drives = Nothing

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...