JSI Tip 3451. How can I get a report of all the Windows 2000 service and device driver objects, showing their short name, Start value, Type, and DisplayName?


The data for the subject report is located in the registry at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

The short name is the registry key, the Start and Type value names are explained in tip 0324 » Registry entries for services, and we discussed DisplayName in tip 3444 » How do I find the short name of a service.

Your report would look similar to:

CmBatt                    3 001 Microsoft ACPI Control Method Battery Driver
cmosa                     1 001 cmosa
Compbatt                  0 001 Microsoft Composite Battery Driver
dmio                      0 001 Logical Disk Manager Driver
Eventlog                  2 020 Event Log
EventSystem               3 020 COM+ Event System
Fastfat                   4 002 Fastfat
UndeleteService           2 110 Executive Software Undelete
Update                    3 001 Microcode Update Driver
UPS                       3 010 Uninterruptible Power Supply
usbhub                    3 001 Microsoft USB Standard Hub Driver
UtilMan                   3 110 Utility Manager
VgaSave                   1 001 VgaSave
W32Time                   2 020 Windows Time
W3SVC                     2 120 World Wide Web Publishing Service
Wanarp                    3 001 Remote Access IP ARP Driver
wdmaud                    3 001 Microsoft WINMM WDM Audio Compatibility Driver
WinMgmt                   2 010 Windows Management Instrumentation
Winsock                   3 004 Winsock
WMDM PMSP Service         2 010 WMDM PMSP Service
Wmi                       3 020 Windows Management Instrumentation Driver Extensions
SvcDrv.bat requires no paramaters, and contains:
@echo off
setlocal
set file1="%TEMP%\ParseReg.reg"
set file2="%TEMP%\ParseReg.tmp"
set reg="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"
regedit.exe /a %file1% %reg%
findstr /L "\[HKEY_ DisplayName Start Type" %file1% > %file2%
set svc=N
set dsp=   #
set dsp=%dsp:~0,1%
set startp=   #
set startp=%startp:~0,1%
set typp=      #
set typp=%typp:~0,3%
for /f "Tokens=*" %%i in ('type %file2%') do set line=%%i&call :parseq
if "%startp%" EQU " " goto last
if "%svc%" NEQ "N" @echo %svc% %startp% %typp% %dsp%
:last
del /q %file1%
del /q %file2%
endlocal
goto end
:parseq
set line=%line:"=%
if /i "%line:~0,6%" EQU "\[HKEY_" goto fs
if "%svc%" EQU "N" goto end
if /i "%line:~0,6%" EQU "Start=" goto strt
if /i "%line:~0,5%" EQU "Type=" goto typ
if /i "%line:~0,12%" EQU "DisplayName=" goto dn
if /i "%line:~0,6%" EQU "\[HKEY_" goto fs
goto end
:dn
set wrk=%line:~11,1%
if not "%wrk:~0,1%" EQU "=" goto end
set dsp=%line:~12,99%
goto end
:strt
if /i "%line:~6,6%" NEQ "dword:" goto end
set startp=%line:~19,1%
goto end
:typ
if /i "%line:~5,6%" NEQ "dword:" goto end
set typp=%line:~16,3%
goto end
:fs
set wrk=%line:\[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\=%
set wrk=%wrk:\]=%
set new=%wrk:\=%
if "%startp%" EQU " " goto nxt
if "%svc%" NEQ "N" @echo %svc% %startp% %typp% %dsp%
:nxt
set svc=N
set dsp=   #
set dsp=%dsp:~0,1%
set startp=   #
set startp=%startp:~0,1%
set typp=      #
set typp=%typp:~0,3%
if "%new%" NEQ "%wrk%" goto end
set wrk=%wrk%                                 #
set svc=%wrk:~0,25%
set dsp=%svc%
:end
NOTE: The report is displayed in a CMD window. If you want hard copy, pipe it to a .TXT file or simply run it like SvcDrv > <Drive:>\Folder\SvcDrv.TXT.




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