Re: System Restore contains Sasser.B on about 500 PC (Network)
From: Torgeir Bakken \(MVP\) (Torgeir.Bakken-spam_at_hydro.com)
Date: 05/07/04
- Next message: Torgeir Bakken \(MVP\): "Re: System Restore contains Sasser.B on about 500 PC (Network)"
- Previous message: April: "IRC/Flood.bat Help?"
- In reply to: Hans Meyer: "System Restore contains Sasser.B on about 500 PC (Network)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 07 May 2004 20:45:29 +0200
Hans Meyer wrote:
> -> Is there a way to whipe out all existing Restore Points by script /
> tool / etc. - perhaps by using rundll32... (admin account) to achive
> the same effect as disabling System Restore manually by Control Panel?
Hi
The script below will disable System Restore (for all drives), thus
removing all existing Restore Points, and then enable System Restore
again.
You can run it against remote computers setting a computer name or
IP address in the sComputer variable.
I personally would have put the script in a a computer startup script
(with a GPO) that runs as part of the boot up process (before the
user logs in). It runs under the system context and has admin rights.
To avoid disabling/enabling System Restore at every bootup, let the
script test on a registry marker, and if that exists, don't run the
rest of the script (the script needs to create the registry marker
the first time it runs).
'--------------------8<----------------------
' connect to the SystemRestore object
sComputer = "." ' use "." for local computer
Set oWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & sComputer & "\root\default")
Set oItem = oWMIService.Get("SystemRestore")
iResults = oItem.Disable("")
' debug code
'If iResults = 0 Then
' Wscript.Echo "System Restore is disabled"
'Elseif iResults = 1717 Then
' Wscript.Echo "System Restore was disabled from before"
'Else
' Wscript.Echo "Unable to disable System Restore, error: " & iResults
'End If
' enable System Restore again
oItem.Enable("")
'--------------------8<----------------------
References:
HOW TO: Use the System Restore Utility with Windows
Management Instrumentation in Windows XP
http://support.microsoft.com/?kbid=295299
Disable Method of the SystemRestore Class
http://msdn.microsoft.com/library/en-us/sr/sr/disable_systemrestore.asp
For more example script, search for "System Restore" here:
http://www.microsoft.com/technet/community/scriptcenter/compmgmt/default.mspx
WSH 5.6 documentation (local help file) can be downloaded from here if you
haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp
-- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: http://www.microsoft.com/technet/community/scriptcenter/default.mspx
- Next message: Torgeir Bakken \(MVP\): "Re: System Restore contains Sasser.B on about 500 PC (Network)"
- Previous message: April: "IRC/Flood.bat Help?"
- In reply to: Hans Meyer: "System Restore contains Sasser.B on about 500 PC (Network)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|