Skip navigation

JSI Tip 4916. How can I get a list of services on a computer that should be started but are currently stopped?


In tip 4915, we displayed a list of services that were stopped on a computer.

Using SCLIST and Reg.exe from the Windows 2000 Support Tools,
or from %WinDir%\System32 of a Windows XP Professional installation,
or from Supplement 4 of the Windows NT 4.0 Resource Kit,
to retrieve a service's Start value, I have scripted SVCSTOPPED.BAT.

The syntax for using SVCSTOPPED.BAT is:

SVCSTOPPED \[MachineName\]

where MachineName is an optional remote computer.

SVCSTOPPED.BAT contains:

@echo off
setlocal
If not \{%1\}==\{\} set machine=%1
if not "%machine%" EQU "" set machine=\\%machine:\\=%
if not "%machine%" EQU "" set remote=%machine%for /f "Skip=4 Tokens=*" %%a in ('sclist -s %machine%') do set line=%%a&call :parse
endlocal
:parse
if "%line%" EQU "" goto :EOF
set service=%line:~17,32%##
set service=%service:  =%
set service=%service: ##=%
set service=%service:##=%
for /f "Skip=2 Tokens=1,2*" %%i in ('REG QUERY "%remote%HKLM\System\CurrentControlSet\Services\%service%" /v Start') do set start=%%k
if "%start%" GTR "0x2" goto :EOF
@echo %start% %service%


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish