Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Need a script that will disable the system restore remotely.

Posted on 2008-06-16
12
1,654 Views
Last Modified: 2008-06-16
Hi,

Need a script that will disable the system restore remotely.

Need a way to be able to disable the system restore from all the machines in the file.

Any way to do this...

Need help urgent,.... Many of my machines has got virus within the folder of system restore.

Regards
Sharath
0
Comment
Question by:bsharath
  • 7
  • 4
12 Comments
 
LVL 26

Expert Comment

by:farhankazi
ID: 21792241
Hi Sharath,

Disable "System Restore Service" service on client machines.
I think you already has a script that read files for computer names and disable mentioned service.
0
 
LVL 11

Author Comment

by:bsharath
ID: 21792304
Hi Farhan

Yes i have it but not doing it on a list of machines...
Its a per machine script if i am not wrong
0
 
LVL 11

Author Comment

by:bsharath
ID: 21792305
Hi Farhan

Yes i have it but not doing it on a list of machines...
Its a per machine script if i am not wrong
0
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
LVL 26

Accepted Solution

by:
farhankazi earned 500 total points
ID: 21792514

:: BATCH SCRIPT START 
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET InputFile=Machines.txt
SET OutputFile=SRSDisableStatus.txt
 
IF NOT EXIST "%InputFile%" ECHO "%InputFile%" file does not exist. &GOTO :EndScript
FOR %%R IN ("%InputFile%") DO IF %%~zR EQU 0 ECHO "%InputFile%" file is empty. &GOTO :EndScript
IF EXIST "%OutputFile%" DEL /F /Q "%OutputFile%"
 
FOR /F %%c IN ('TYPE "%InputFile%"') DO (
	ECHO Processing: %%c
	PING -n 1 -w 1000 %%c|Find /I "TTL" >NUL
	IF NOT ERRORLEVEL 1 (
		SC \\%%c STOP "srservice" >>%OutputFile%
		SC \\%%c config "srservice" start= disabled >>%OutputFile%
	)ELSE (ECHO Unable to connect %%c: system may be offline.))
 
ECHO. &ECHO Script complete. Check "%OutputFile%" file.
:EndScript
ENDLOCAL
EXIT /B 0
:: BATCH SCRIPT END

Open in new window

0
 
LVL 11

Author Comment

by:bsharath
ID: 21792542
Farhan

Does this just stop or restart

I get this in the file


SERVICE_NAME: srservice
        TYPE               : 20  WIN32_SHARE_PROCESS  
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x3a98
[SC] ChangeServiceConfig SUCCESS
0
 
LVL 11

Author Comment

by:bsharath
ID: 21792543
Farhan

Does this just stop or restart

I get this in the file


SERVICE_NAME: srservice
        TYPE               : 20  WIN32_SHARE_PROCESS  
        STATE              : 3  STOP_PENDING
                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x3a98
[SC] ChangeServiceConfig SUCCESS
0
 
LVL 26

Expert Comment

by:farhankazi
ID: 21792559
First it will stop the service then it will disable the service.
0
 
LVL 11

Author Comment

by:bsharath
ID: 21793523
Ok what does the above code mean...
has it stopped and disabled?
0
 
LVL 26

Expert Comment

by:farhankazi
ID: 21794308
Above output shows that the service is process of STOP.
0
 
LVL 58

Expert Comment

by:tigermatt
ID: 21795486
Sharath,

I know you wanted a scripting method to do this, but have you seen the method provided by Group Policy to achieve the same? See http://www.theeldergeek.com/re-enable_system_restore.htm (although do it in Group Policy Management  and not through gpedit.msc!)

Matthew
-tigermatt
0
 
LVL 11

Author Comment

by:bsharath
ID: 21795531
Matthew but i need to do this just for selected computers that have virus sitting inside the restore folder...
So a script is useful...Any ways thanks for the link would be useful some time....
0
 
LVL 11

Author Comment

by:bsharath
ID: 21799395
Thanks Farhan
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question