turn off system restore script

11 Aug

for Windows XP only, you can even script this. The Microsoft
TechNet Script Center has a sample script that’ll get you
started:
http://www.microsoft.com/technet/community/scriptcenter/compmgmt/scrcm92.mspx
or http://snipurl.com/8bsr . Here’s an expanded version that
attempts to disable System Restore for every computer listed in a
text file you provide:

‘get input file name
Dim sInputFile
sInputFile = _
InputBox(“Enter path and filename to input file” & _
“(list of computer names”, “Input file”)

‘clicked cancel?
If sInputFile = “” Or sInputFile = -1 Then
WScript.Quit
End If

‘open input file
Dim oFSO, oTS
Set oFSO = WScript.CreateObject(“Scripting.FileSystemObject”)
On Error Resume Next
Set oTS = oFSO.OpenTextFile(sInputFile)
If Err <> 0 Then
MsgBox “Couldn’t open input file.”
WScript.Quit
End If
On Error Goto 0

‘go through names in file
Dim sComputer, oPing, oStatus
Do Until oTS.AtEndOfStream

‘get name
sComputer = oTS.ReadLine

‘name provided?
If sComputer <> “” Then

‘connect to the WMI provider
On Error Resume Next
Set oWMIService = GetObject(“winmgmts:\\” & _
sComputer & “\root\default”)
Set oItem = oWMIService.Get(“SystemRestore”)
errResults = oItem.Disable(“”)
On Error Goto 0

End If
Loop

‘finished – notify
oTS.Close
MsgBox “Script is finished executing.”