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


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


Relevant Pages

  • Re: system restore not creating system checkpoints
    ... Bert's script does work and should have created a new checkpoint after the ... >> Make sure that the Task Scheduler and SR Services are running by typing ... >> Will Denny ... >>> I did myself when turning off, then back on system restore. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Auto Restore Point?
    ... never written a vbs script): ... Here is a script that checks ... > If no System Restore point exists for the current day, ... > Windows XP Troubleshooting ...
    (microsoft.public.windowsxp.general)
  • Re: REPOST Installing inf files
    ... Thanks for the download link - I ... can now run the VB script and I appear to have my functionality back, ... System Restore couldn't get back to my restore ... however this wouldn't run as I got 'Can't find script ...
    (microsoft.public.windowsxp.general)
  • Re: Very strange Startup Problem! Please advise
    ... > can do the System Restore. ... > If you can run a cmd window, then perhaps you can call a script to run ... > MCSE, MCDBA, MCSA ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: C:/ programs GONE awol!!
    ... Disabling System restore is not necessarily required before starting repair. ... > to disable it because I cant access much of anything. ...
    (microsoft.public.security.virus)