Solved

Batch file to disable services???

Posted on 2003-10-30
8
4,679 Views
Last Modified: 2007-12-19
i am trying to create a batch file to save me time. My goal is to run it on any windows xp computer, it will ask a few questions and then disable all services not needed. So far it is working ok.

Here is the problem.... I completed the batch file yestarday and when i run it everything runs fine.  I assumed it was good and done. so yestarday i ran it on a clients pc and it disabled their dsl, wierd huh??? i then ran it on another computer that didn't have dsl. now this computer can't get on the internet with juno, weird. anyways i ran system restore on both to a date before i screwed things up. it fixed everything fine. my problem is i don't know which service i am disabling that are causing these problems. i have gone to www.blackviper.com before but the site has been down for 2 days. if anybody has had these problems from disableing a service please let me know which service.
0
Comment
Question by:Paul S
  • 4
  • 3
8 Comments
 
LVL 41

Accepted Solution

by:
stevenlewis earned 25 total points
ID: 9654782
0
 
LVL 22

Expert Comment

by:senad
ID: 9655203
svchost.exe
This is the file you have been screwing with.
0
 
LVL 11

Author Comment

by:Paul S
ID: 9655987
my batch file uses the command
sc config (service name) start= (auto/demand/disabled)
0
 
LVL 22

Expert Comment

by:senad
ID: 9660704
gimme  the exact batch file here to view...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 11

Author Comment

by:Paul S
ID: 9661363
i think i fixed my problem but i won't be able to test it for a while. but i will list batch file here. Feel free to copy the code and use it. i am trying to find a good website to upload it to. any ideas? i need to throughly test it first though. can you guys run it and see if it screws up your system? just make a restore point first or use the batch file to do it i unclude code for vb script needed for restore point

***batch file begin here******

@echo off
cls
ECHO This program will attempt to speed up Windows XP Home or Pro
echo it will do so by disabling un needed services
echo.


:start1
set /p input=OK to run program (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto starty
if "%input%"=="n" goto startn
echo invalid choice
goto start1

:starty
goto start

:startn
goto exit


:start
cls
echo a restore point will now be created please don't do anything
echo until a message pops up telling you it's done.
pause
echo creating restore point.....
start /w restorept.vbs
cls
echo if you answer any of the questions wrong
echo use the restore point that was just created
echo then run this program again.
pause
cls



rem disables system event notification service
:SENS1
sc config SENS stop>nul
sc config SENS start= disabled>nul


rem disables WMI Performance Adapter service

:WmiApSrv1
sc config WmiApSrv stop>nul
sc config WmiApSrv start= disabled>nul


rem disables volume shawdow copy service

:VSS1
sc config VSS stop>nul
sc config VSS start= disabled>nul


rem disables Web Client service

:WebClient1
sc config WebClient stop>nul
sc config WebClient start= disabled>nul


rem disables upload manager service

:uploadmgr1
sc config uploadmgr stop>nul
sc config uploadmgr start= disabled>nul


rem disables UPNPhost service

:UPNPhost1
sc config UPNPhost stop>nul
sc config UPNPhost start= disabled>nul


rem disables terminal services service

:TermService1
sc config TermService stop>nul
sc config TermService start= disabled>nul


rem disables telnet service

:TlntSvr1
sc config TlntSvr stop>nul
sc config TlntSvr start= disabled>nul


rem disables ssdp discovery service

:SSDPSRV1
sc config SSDPSRV stop>nul
sc config SSDPSRV start= disabled>nul


rem disables secondary logon service

:seclogon1
sc config seclogon stop>nul
sc config seclogon start= disabled>nul


rem disables routing and Remote Access service

:RemoteAccess1
sc config RemoteAccess stop>nul
sc config RemoteAccess start= disabled>nul


rem disables remote registry service

:RemoteRegistry1
sc config RemoteRegistry stop>nul
sc config RemoteRegistry start= disabled>nul


rem disables remote access help service

:RDSessMgr1
sc config RDSessMgr stop>nul
sc config RDSessMgr start= disabled>nul


rem disables Network Qos Service (slows network performance)

:RSVP1
sc config RSVP stop>nul
sc config RSVP start= disabled>nul


rem disables portable mp3 device serial number Service

:WmdmPmSp1
sc config WmdmPmSp stop>nul
sc config WmdmPmSp start= disabled>nul


rem disables system performance logs Service

:SysmonLog1
sc config SysmonLog stop>nul
sc config SysmonLog start= disabled>nul


rem disables NetDDE dsdm Service

:NetDDEdsdm1
sc config NetDDEdsdm stop>nul
sc config NetDDEdsdm start= disabled>nul


rem disables NetDDE Service

:NetDDE1
sc config NetDDE stop>nul
sc config NetDDE start= disabled>nul


rem disables net meeting remote desktop Service

:netmeet1
sc config mnmsrvc stop>nul
sc config mnmsrvc start= disabled>nul


rem disables indexing Service

:index1
sc config cisvc stop>nul
sc config cisvc start= disabled>nul


rem disables windows help Service

:help1
sc config helpsvc stop>nul
sc config helpsvc start= disabled>nul


rem disables FastUserSwitching Compatibility Service

:fast1
sc config FastUserSwitchingCompatibility stop>nul
sc config FastUserSwitchingCompatibility start= disabled>nul


rem disables error reporting Service

:error1
sc config ERSvc stop>nul
sc config ERSvc start= disabled>nul


rem disables link tracking Service

:link1
sc config TrkWks stop>nul
sc config TrkWks start= disabled>nul

rem disables computer browser Service

:browse1
sc config Browser stop>nul
sc config Browser start= disabled>nul


rem disables clipbook Service

:clip1
sc config ClipSrv stop>nul
sc config ClipSrv start= disabled>nul


rem disables Background Intelligent Transfer Service

:back1
sc config bits stop>nul
sc config bits start= disabled>nul


rem disables messenger service   ***security hole*****

:mess1
sc config Messenger stop>nul
sc config Messenger start= disabled>nul


rem disables alerter service

:alert
sc config Alerter stop>nul
sc config Alerter start= disable>nul


rem wireless network card service

:wire1
set /p input=Do you have a wireless network card (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto wirey
if "%input%"=="n" goto wiren
echo invalid choice
goto wire1

:wirey
goto wirex

:wiren
sc config WZCSVC stop>nul
sc config WZCSVC start= disabled>nul

:wirex


rem power backup service

:ups1
set /p input=Do you have a battery backup for this pc (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto upsy
if "%input%"=="n" goto upsn
echo invalid choice
goto ups1

:upsy
goto upsx

:upsn
sc config ups stop>nul
sc config ups start= demand>nul

:upsx


Rem ICS and ICF service

:SharedAccess1
set /p input=Do you use windows' built in firewall or internet connection sharing (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto SharedAccessy
if "%input%"=="n" goto SharedAccessn
echo invalid choice
goto SharedAccess1

:SharedAccessy
goto SharedAccessx

:SharedAccessn
sc config SharedAccess stop>nul
sc config SharedAccess start= disable>nul
sc config Nla stop>nul
sc config Nla start= disabled>nul

:SharedAccessx


Rem update service

:wuauserv1
set /p input=Do you want your PC kept up-to-date automaticaly(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto wuauservy
if "%input%"=="n" goto wuauservn
echo invalid choice
goto wuauserv1

:wuauservy
goto wuauservx

:wuauservn
sc config wuauserv stop>nul
sc config wuauserv start= disable>nul

:wuauservx


rem server service

:lanmanserver1
set /p input=Aure you part of a network that shares files or printers(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto lanmanservery
if "%input%"=="n" goto lanmanservern
echo invalid choice
goto lanmanserver1

:lanmanservery
sc config lanmanserver start= auto>nul
goto lanmanserverx

:lanmanservern
sc config lanmanserver stop>nul
sc config lanmanserver start= disable>nul

:lanmanserverx


rem smart card service

:SCardSvr1
set /p input=Is this PC a laptop(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto SCardSvry
if "%input%"=="n" goto SCardSvrn
echo invalid choice
goto SCardSvr1

:SCardSvry
goto SCardSvrx

:SCardSvrn
sc config SCardSvr stop>nul
sc config SCardSvr start= disable>nul
sc config SCarddrv stop>nul
sc config SCarddrv start= disable>nul

:SCardSvrx


rem netbios service

:LmHosts1
set /p input=Do you use netbios over tcp/ip(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto LmHostsy
if "%input%"=="n" goto LmHostsn
echo invalid choice
goto LmHosts1

:LmHostsy
goto LmHostsx

:LmHostsn
sc config LmHosts stop>nul
sc config LmHosts start= disable>nul

:LmHostsx


rem themes service

:Themes1
set /p input=Does this pc use visual themes(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto Themesy
if "%input%"=="n" goto Themesn
echo invalid choice
goto Themes1

:Themesy
goto Themesx

:Themesn
sc config Themes stop>nul
sc config Themes start= disable>nul

:Themesx


rem windows image acquasition service

:stisvc1
set /p input=does this pc use a digital camera, web cam, or scanner(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto stisvcy
if "%input%"=="n" goto stisvcn
echo invalid choice
goto stisvc1

:stisvcy
goto stisvcx

:stisvcn
sc config stisvc stop>nul
sc config stisvc start= disable>nul

:stisvcx


rem windows time service

:W32Time1
set /p input=Do you want your pc to get the right time off the net(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto W32Timey
if "%input%"=="n" goto W32Timen
echo invalid choice
goto W32Time1

:W32Timey
goto W32Timex

:W32Timen
sc config W32Time stop>nul
sc config W32Time start= disable>nul

:W32Timex


rem remote access connection manager and remote access auto connection manager services

:RasMan1
set /p input=Are you part of a network or use the internet on this pc(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto RasMany
if "%input%"=="n" goto RasMann
echo invalid choice
goto RasMan1

:RasMany
set /p input=Are you part of a network that uses a domain or vpn(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto netlogony
if "%input%"=="n" goto netlogonn
echo invalid choice
goto RasMany

:netlogonn
sc config Netlogon stop>nul
sc config Netlogon start= disabled>nul
sc config PolicyAgent stop>nul
sc config PolicyAgent start= disabled>nul



:netlogony
goto RasManx

:RasMann
sc config RasMan stop>nul
sc config RasMan start= disabled>nul
sc config RasAuto stop>nul
sc config RasAuto start= disabled>nul
sc config Netman stop>nul
sc config Netman start= disabled>nul

:RasManx


rem print spooler service

:Spooler1
set /p input=Does this pc have a printer(y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto Spoolery
if "%input%"=="n" goto Spoolern
echo invalid choice
goto Spooler1

:Spoolery
goto Spoolerx

:Spoolern
sc config Spooler stop>nul
sc config Spooler start= demand>nul


:Spoolerx



rem logical disk managment service

:dmserver1
set /p input=Do you use the Disk Management MMC console (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto dmservery
if "%input%"=="n" goto dmservern
echo invalid choice
goto dmserver1

:dmservery
goto dmserverx

:dmservern
sc config dmserver stop>nul
sc config dmserver start= demand>nul


:dmserverx



rem ImapiService service (windows xp bulit in burning app)

:dmserver1
set /p input=Do you use the built in windows xp burning system (y/n) ?
set userinp=%userinp:~0,1%
if "%input%"=="y" goto ImapiServicey
if "%input%"=="n" goto ImapiServicen
echo invalid choice
goto ImapiService1

:ImapiServicey
goto ImapiServicex

:ImapiServicen
sc config ImapiService stop>nul
sc config ImapiService start= disabled>nul


:ImapiServicex







cls
echo .
echo .
echo System is now optimized

echo .
echo .
echo *****************************
echo disable fast user switching.
echo *****************************

Pause
:exit
exit



****batch file end here****


***vb script start here*****


'Unattended System Restore Point
'sysrestorepoint.vbs
'© Doug Knox - rev 02/06/2002
'This code may be freely distributed/modified
'Downloaded from www.dougknox.com
'Extracted from original code by Bill James - www.billsway.com

Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")

msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time

If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
    MsgBox msg
Else
    MsgBox "Restore Point creation Failed!"
End If

Set sr = Nothing


****vb script end******
0
 
LVL 22

Expert Comment

by:senad
ID: 9661553
wow !
0
 
LVL 11

Author Comment

by:Paul S
ID: 9661815
yeah it's pretty long, but it is very simple. i copyed ask a question code because the commands have changed since win98.
0
 
LVL 11

Author Comment

by:Paul S
ID: 9784512
i think i fixed it thanks guys.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now