Error DataBase-One Place all Solutions Forums Blog Glossary    Contact Us
Search  
   
Browse by Category
Error DataBase-One Place all Solutions .: Operating Systems .: Windows Operating Systems .: Windows Scripts and Batch Files .: Batch to Disable System Restore

Batch to Disable System Restore

Here's a script that'll turn it off on multiple XP computers. This script expects an input text file listing the computer names on which System Restore should be turned off. Please be sure to test this with 1-2 computers before letting it loose on your entire network.

_________________________________________________________________________________________________

'get input file anme
Dim sInputFiles
InputFile = 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 & "ootdefault")  
Set oItem = oWMIService.Get("SystemRestore")  
errResults = oItem.Disable("")      
On Error Goto 0     
End If
Loop

'finished - notify
oTS.Close
MsgBox "Script is finished executing."


How helpful was this article to you?

Related Articles

article Batch file to AutoLog to NT/2000/XP only and disable the Novell Login screen
Configure Auto-Login to NT/2000/XP only and...

(No rating)  5-2-2008    Views: 160   
article How to Change the Amount of Disk Space Used by System Restore
The System Restore program created restore...

(No rating)  3-27-2008    Views: 148   
article How to restore Mysql database From the Command Prompt ?
If you are moving your data to a new server,...

(No rating)  3-8-2008    Views: 817   

User Comments

Add Comment
No comments have been posted.