How do I find out service pack level from Command Prompt

E

ed

I've tried the spcheck tool from Microsoft, but it is not
what I really wanted.

I want to scan the whole network to find out what service
pack levels each windows 2000 machine is on. Something
that has one line saying

wkstation2.mydomain.com - SP2

(something like that) would be more than enough

Thanks for any input :)

eD
 
R

Ray at

I threw this together the other day. I'm sure someone else would have a
better solution, but it works for me.

Note that it uses gettype from the resource kit and reg.exe from Dave
Thomas. The download site no longer exists, it seems, but you could adapt
it for the reg.exe that comes with Windows XP.


@echo off
if {%1}=={} goto Syntax

echo.
REM ECHO Attempting update on %1
REM echo Resolving computer

Set compName=%1
Set firstTwo=%compname:~0,2%


if {%compName%}=={\\} goto Syntax
if {%compName%}=={\} goto Syntax
if {%firstTwo%} NEQ {\\} set compName=\\%compName%

utility\gettype %compName%
utility\reg -ListValue "%compName%\MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\CSDVersion"


goto :EOF

:Syntax
echo.
echo Will return statement about service pack level of Windows NT and 2000
machines
echo -----------------------------------------------------------------------
-------
echo Usage:
echo sp \\computername
echo.
:END
echo.

Ray at work
 
R

Ray at

<in reply to a private e-mail>

Hi Erward,

In the code I have below, note that I have gettype.exe and reg.exe in a
subdirectory called "utility." Either put them in the same directory, or
delete the references to it and just put them anywhere in your %path%
variable. (If you're not sure what that means, put them in your
\winnt\system32 directory.)

Paste that script into a file and name it checksp.bat. Then, if you'd like
to loop through all available computers, then make another .bat file called
something like checkall.bat and put contents as such in it:


for /f "skip=3" %%j in ('net view') do (call LogSP %j)
goto :EOF
LogSP:
set compname=%1
set compname=%compname:~2,99%
checksp %compname%>%compname%>log


That will loop through the computers in "net view" and log the sp result to
a files named <theNameOfEachComputer>.log.

You can do this different ways. I don't know if the one file per computer
method is what you'd want. That's what I often do.

Ray at home

p.s. I am a complete novice at .bat and I stumble through my own ways of
doing things and often later find that someone else does the same thing in a
much more efficient and logical way. So, you may want to check back for
others' criticisms!




Ray at said:
I threw this together the other day. I'm sure someone else would have a
better solution, but it works for me.

Note that it uses gettype from the resource kit and reg.exe from Dave
Thomas. The download site no longer exists, it seems, but you could adapt
it for the reg.exe that comes with Windows XP.


@echo off
if {%1}=={} goto Syntax

echo.
REM ECHO Attempting update on %1
REM echo Resolving computer

Set compName=%1
Set firstTwo=%compname:~0,2%


if {%compName%}=={\\} goto Syntax
if {%compName%}=={\} goto Syntax
if {%firstTwo%} NEQ {\\} set compName=\\%compName%

utility\gettype %compName%
utility\reg -ListValue "%compName%\MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\CSDVersion"


goto :EOF

:Syntax
echo.
echo Will return statement about service pack level of Windows NT and 2000
machines
echo -----------------------------------------------------------------------
 
M

Mark V

ed wrote in
I've tried the spcheck tool from Microsoft, but it is not
what I really wanted.

I want to scan the whole network to find out what service
pack levels each windows 2000 machine is on. Something
that has one line saying

wkstation2.mydomain.com - SP2

(something like that) would be more than enough

Not batch help per se, but you might be insterested in psinfo.exe (SP
reported) and psexec.exe (remote execution) from www.sysinternals. com
(free)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top