Re: Retrieving Service Pack version from DOS

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Torgeir Bakken (MVP) (Torgeir.Bakken-spam_at_hydro.com)
Date: 02/28/04


Date: Sat, 28 Feb 2004 04:14:08 +0100

anonymous@discussions.microsoft.com wrote:

> I am writing a diagnostic batch file for my company and I
> know the ver will give the operating system, but is there
> a command that will give the service pack that is
> installed?

Hi

Try this batch file (watch for line wrap, the two reg.exe callout
lines are 123 characters long):

--------------------8<----------------------
@echo off
set SPLevel=0
Reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion | FIND/I "Service Pack 1" && set SPLevel=1
Reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion | FIND/I "Service Pack 2" && set SPLevel=2
cls
echo.
echo Service pack level: %SPLevel%
echo.
pause
--------------------8<----------------------

Some external command line based free utilities that also
are able to help you:

The free OSVer.exe in the "Admin Script Tools" at
http://home.comcast.net/~stewartb/wast.html

<quote>

OSVER allows a batch file to perform operating system platform checking. It
can differentiate between Windows 95, Windows 98, Windows Me, Windows NT
4.0, Windows 2000, Windows XP, and Windows Server 2003. For NT-based
systems, it can also return the system's service pack level and role (e.g.
workstation, server, or domain controller). For Windows NT 4.0 SP6 and
later, it can also detect whether the system is a Terminal Server (either
remote administration mode or application server mode).
<quote>

Some other free command line utilities that can obtain a lot
of information on local and remote computers:

A)
PSInfo, for local and remote computers.

PSInfo.exe is in the in the free PsTools suite found at
http://www.sysinternals.com/

B)

Here is another one:

Console Computer Information Utility for 2000/XP
http://www.beyondlogic.org/solutions/compinfo/compinfo.htm

Use it in conjunction with BeyondExec (from same Web site) to get details of
remote computers. Beyondexec also have multiple computer functionality.

C)

For the ultimate tool in information gathering, you have AIDA32 (free):

http://www.aida32.hu/aida32.php

It can do automatic audit (e.g. using a logon script) via command-line
switches and save results to a file in various formats like HTML, CSV
or XML, or put it in a database (it has ADO/ODBC database support)

5.1 Command-line Mode
http://www.aida32.hu/proguide/en/proguide.htm#commandline_mode

AIDA32 network audit in practice
http://www.aida32.hu/aida-articles.php?n=002&lang=en

Using SQL databases for AIDA32.
http://www.aida32.hu/aida-articles.php?n=003&lang=en

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter


Relevant Pages

  • Re: OpenGL under threat?
    ... isn't the OPERATING SYSTEM supposed to be just that, ... red letters to say this again, Windows SHOULD NOT BE AN APPLICATION. ... The answer is no (not without going to a "Command Box" and doing it ... In my opinion, no one, no one should ever have to see ...
    (comp.cad.solidworks)
  • Re: OpenGL under threat?
    ... Mike Tripoli wrote: ... All this shit brings me full circle back to the most fundamental computing question there is: isn't the OPERATING SYSTEM supposed to be just that, the layer above the BIOS and NOT AN APPLICATION! ... I wish I could make giant red letters to say this again, Windows SHOULD NOT BE AN APPLICATION. ... The answer is no (not without going to a "Command Box" and doing it through a command line). ...
    (comp.cad.solidworks)
  • Re: evangelizing linux not needed
    ... Linux is never going to be their choice over ... these things and I use Linux exclusively, except for a few command line ... Windows user if they ever got a chance to use it. ... If you dwell on THE ONE program that a certain operating system doesn't have ...
    (alt.os.linux)
  • Re: Removing Recent Documents In Registry
    ... Microsoft MVP [Windows] ... "Don Bledsoe" wrote: ... the command was ??edit.msc not sure ... | same command be done in the XP Operating System.. ...
    (microsoft.public.win2000.registry)
  • Re: Safe mode Trouble
    ... wait long enough for windows to load when you first tried after using F8. ... > was going to run a virus scan from safe mode. ... went to the command line ... > operating system, it came up with the message, Windows ...
    (microsoft.public.windowsxp.configuration_manage)