Scanning for Service Pack versionions via dos on a network?

  • Thread starter Thread starter Jonathan Hylton
  • Start date Start date
J

Jonathan Hylton

Hi there,

right now we need to be scanning our network to make sure
everyone is patched to keep port 135 from being exploited.
Now if people are running less than SP3 the persons
machine will still be vulnerable to this attack as at
least SP3 is needed for this to work.

Is there a command or a tool that I can use via the dos
line to scan my companies subnet for machines that do not
have at least SP3 on windows 2k machines?


Thanks

Jonathan
 
Jonathan Hylton said:
Is there a command or a tool that I can use via the dos
line to scan my companies subnet for machines that do not
have at least SP3 on windows 2k machines?

psinfo - sysinternal.com
hfnetchk - shavlik.com

Both are free.
 
This is one I've used for almost two years.

Use the program REG.exe
(standard in XP, but also works in 2000)
Download REG.exe
or copy it from the Windows 2000 Resource Kit
to your WINNT\SYSTEM32 folder.

Before running the script,
build a list of your computer names in a file
named computerlist.txt.

I type

NET VIEW > computerlist.txt

Remove the top and bottom lines from the file
so that only the computer names are listed.
Do not remove the two back-slashes \\ from the front.

The file should look like this:

\\computer1
\\computer2
\\computer3

You may need to place at least one space
after each computer name.
Mine comes out that way automatically.

You may also need to tweak the BAT file for your situation.
Such as change the Delimiter settings.

The script will appear broken into may lines on screen.
It should only be 6 lines total.
Each line starts with FOR and ends with .LOG

:::::::: START OF BATCH SCRIPT 1 ::::::::

FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 1" && ECHO %%A >> SP1.LOG
FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 2" && ECHO %%A >> SP2.LOG
FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 3" && ECHO %%A >> SP3.LOG
FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 4" && ECHO %%A >> SP4.LOG
FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 5" && ECHO %%A >> SP5.LOG
FOR /F "TOKENS=1 DELIMS= " %%A IN ('TYPE computerlist.txt') DO REG QUERY "%%A\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /V CSDVersion | FIND/I "Service Pack 6" && ECHO %%A >> SP6.LOG

:::::::: END OF BATCH SCRIPT 1 ::::::::

The computer name output will be placed in files called:

SP1.LOG
SP2.LOG
SP3.LOG
SP4.LOG
SP5.LOG
SP6.LOG

If a computer has Service Pack 1 installed, you will see
\\somecomputername
listed in file SP1.LOG

If a computer has Service Pack 2 installed, you will see
\\somecomputername
listed in file SP2.LOG

Austin M. Horst
 
Back
Top