Sysinternals Homepage
Forum Home Forum Home > Sysinternals Utilities > Utilities Suggestions
  New Posts New Posts RSS Feed - Extended ver command
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Extended ver command

 Post Reply Post Reply
Author
Message
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Topic: Extended ver command
    Posted: 10 June 2010 at 2:37am
I was a little frustrated in my scripting endeavours with the builtin ver command. This command only provides some limited data on the installed Windows version number and nothing else, so i've come up with some ideas on what a "super" version of this command might be like. Since this hypothetical program would be an extended version of ver, and be complimentary to the setx command, i'll suggest calling it verx.


VERX
/csd [/e]       Returns service pack level
Ex: Service Pack 1
/build [/e] Returns build number
Ex: 7100
/type Returns build type
Ex: Multiprocessor Free
/cv Returns version number in Major.Minor format
Ex: 6.1
/name Returns product name
Ex: Windows Vista (TM) Ultimate
/lang [/e] Language version number, name & TLA
Ex: 1033 English - United States ENU
/lcid [/e] [/ra] Get Locale ID info
Ex: en-ca 0x1009 4105
/format [/e] [/ra] Get User Locale info
/sku [/e] Stock Keeping Unit number and name
Ex: 6 Business Edition
/eid Returns EditionID data
Ex: Professional OEM 0
/office [/apps] [/e] Returns info on installed Office version
Ex: 12 SP2 2007 Enterprise 1033
/dotnet .Net Framework versions, SP level & lang
Ex:
2.0 SP2 1033
3.0 SP2 1033
3.5 SP1 1033
/dx [/e] DirectX version
Ex: 11 Feb2010
/ie [/csd] Internet Explorer info
Ex: 8.0
/dupdesc        Description of the duplicator file used
/all Creates report
/file [path\]filename Returns file version
<switch> /e Sets exitCode as returned value
<switch> /ra Returns values for Reserved Accounts instead of CU
 
Get version of offline Windows installation:
 
verx /cv /offwindir=<offline windows directory>

Use a for /F loop to get offline version into envar:
 
for /f %i in ('verx /cv /offwindir=d:\windows') do @set offCV=%i

Use this environment variable to determine what operations should be run on offline system:
 
if %offCV% geq 6.0 sfc /scannow /offbootdir=d:\ /offwindir=d:\windows
 
Could be useful in WinPE.

 
Get LCID string value into envar and use this to copy MUI files from and to appropriate folders:
 
for /F %A in ('verx /lcid /ra') do @set LCIDstr=%A
copy %windir%\System32\certutil.exe D:\WinPE\mount\Windows\System32
copy C:\Windows\System32\%LCIDstr%\certutil.exe.mui D:\WinPE\mount\Windows\System32\%LCIDstr%
 

Save operating system version to master environment for future use:

for /f "tokens=1,2" %i in ('verx /cv /build') do @setx OS_Version %i.%j /m

 
Get file version:
 
verx /file %programfiles%\Microsoft Silverlight\sllauncher.exe
3.0.50106.0

 
Get version info for remote system:
 
verx
\\Server /all

 

"DuplicatorDescription specifies a description of the duplication tool used, as well as any other information that an OEM or an administrator might store in the registry."

> verx /dupdesc
> "ImageX - Vista_x86 - ImgVer:1.3.28""
 
 
 
An interesting example of someone having to post to a forum to find out how to determine what version of Windows Embedded a machine is running:
 


Edited by Drewfus - 01 March 2011 at 4:05am
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2010 at 7:43am

Another option, to display the Windows version id:

 
 
/os    Returns version identifier
       Ex: Vista_X86
       Ex: Server2008R2_X64
 
 
See Inf2Cat doco for WindowsVersionList: http://msdn.microsoft.com/en-us/library/ff547089(v=VS.85).aspx
 
Btw, these identifiers would be nice to have in MSU filenames. Ex: Server2008_X64-KB954768.msu
 


Edited by Drewfus - 20 February 2011 at 2:08am
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 05 September 2010 at 7:29am

Switches for inf files.

 

 

/inf        [path]filename.inf [today|date[,*|#|+.*|#|+.*|#|+.*|#|+]] [/df:inf|iso|cu]

Displays date and version number from Version section of an inf file.

OR

Writes new date or date and version to the Version section of an inf file.

 

today: Resolves to current date in mm/dd/yyyy format

date: Any valid date in format specified by /df switch

/df: Specifies date format (for reading or writing)

                  inf: mm/dd/yyyy  (default)
                  iso: YYYY-MM-DD

                  cu: current users regional setting

                  *  : existing value

                  #  : new value in range 0-9999

                  +  : increment existing value

 

            Ex:  >verx /inf mydriver.inf

     >10/5/2010,6.1.12.3474

 

            Ex:  >verx /inf mydriver.inf 2010-10-06,*.*.*.+ /df:iso

                 >10/6/2010,6.1.12.3475

 

 

This would be similar to the functionality of the Stampinf command, but might avoid date formatting problems. Also adds read function.

 

 

/osdec      [\\Server] [/arch | /maj | /min | /pt | /sm]

            Returns OS decoration (for use in Manufacturer section)

            /arch: nt + hardware platform (one of x86, ia64, or amd64)

            /maj: OSMajorVersion and previous fields

            /min: OSMinorVersion and previous fields

            /pt:  ProductType and previous fields

            /sm:  SuiteMask and previous fields

 

            Ex:  >verx /osdec

     >ntamd64.6.1.0x0000001.0x00000010

 

Ex:  >verx /osdec /min

     >ntamd64.6.1

 


Edited by Drewfus - 20 February 2011 at 2:22am
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2010 at 9:52am
Here's an example where a more sophisticated ver command might help for an application install.
 
 
There are Microsoft support sites that outline how to determine the installed version numbers for SQL Server, dotNet Framework, Office and others, such as...
 
 
 
 
These methods generally involve querying registry values. Why not make things easy, with a simple command?
 
 
A few more switch options...
 
 
/sqlsvr       Returns SQL Server installations and (perhaps) instance names
 
/wua          Returns the installed version of the Windows Update Agent
 
/wul          Returns versions of registered Microsoft/Windows/Office Update related DLLs.
              E.g. LegitControlCheck.dll, MuCatalogWebControl.dll, OGAControl.dll
 
/ntos         Returns loaded Kernel and HAL versions
              Ex:
              >HAL=halmacpi.dll=6.1.7600.16385
              >Kernel=NTKRPAMP.EXE=6.1.7600.16385
 
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 15 October 2010 at 11:46am
Ok, i forgot about Windows Installer.
 
 
/winst          Returns Windows Installer version
                Ex:
                > 4.5.6001.22159
 
 
Do i have the latest version for my SKU?
 
 
 
How do i check?
 
 
/winst /chkupd   Returns installed Windows Installer version and checks online for available updates.
                 Ex:
                 > Installed = 3.1.4000.2435
                 > Available = 4.5.6001.22159
 
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 18 November 2010 at 12:42am
So we need a way of displaying installed app details from the command line.


/uninst      [/cu] [/nbsp] [cmnt|ccn|tel|hent|ico|ver|upd|url|rme|sinf]
             Displays a list of app details by querying the registry key:
             HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

             /cu  Instead queries:
             HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

             /nbsp  Spaces within fields are replaced by non-breaking spaces. This allows treating each field as a single unit - for example when using a for /F loop, each token becomes equivalent to a field. Replace non-breaking spaces in command output with a normal space character by using command line substitution.

             By default the command displays Name, Publisher, Installed On, Size. Extra display options are available as follows:

             /cmnt  Comments
             /ccn   Contact (Company Contact Name)  
             /tel   Help Telephone
             /hent  Hide Entry
             /ico   Icon
             /upd   Product Updates
             /url   URL
             /rme   readMe
             /sinf  Support Information

 
 
Also see this post: Finding all installed programs from the registry


Edited by Drewfus - 20 February 2011 at 2:26am
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 24 November 2010 at 10:52pm
The WMI class Win32_Product could be used for this purpose, however this method has two significant problems;
 
1. Only applicable to Windows Installer products.
2. Enumeration efficiency is poor. Why Win32_Product is Bad News!
 
Consequently there is no way of getting a comprehensive listing of installed software from the command line!
 
Perhaps querying the Uninstall keys in the registry is not a thorough enough method for determining installed products, and/or perhaps this would return too much "noise". Maybe Verx could have some sort of extensible interface that vendors could exploit to get their products recognised accurately.
 
Assume some vendor libraries like:
 
verMSFT.dll
verAPPL.dll
verGOOG.dll
verJAVA.dll
 
Register these libraries during product installation or at the command prompt via regsvr32.exe.
 
Now corresponding switches - /MSFT, /APPL /, /GOOG, /JAVA - are available.
 
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 30 December 2010 at 11:44pm
Codecs.
 
 
/codecs        [-a|-v] [-m]
               List installed codecs. Diplays codec name, version and encode/decode 'attributes' (E,D and perhaps others).
 
                -a  Show only audio codecs.
                -v  Show only video codecs.
                -m  Hide Microsoft codecs.
 
Back to Top
Drewfus View Drop Down
Groupie
Groupie


Joined: 12 February 2010
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote Drewfus Quote  Post ReplyReply Direct Link To This Post Posted: 04 February 2011 at 2:48am
Drivers
 
 
"In my talks, I also show you that clicking on the !analyze -v hyperlink will dump more information, including the kernel stack of the thread that was executing when the crash occurred. That’s often useful when the heuristics fail to pinpoint a cause, because you might see a reference to a third-party driver that, by being active around the site of the crash, might be the guilty party. Checking for a newer version of any third-party drivers displayed in this basic analysis often leads to a fix." [Emphasis added]
 
Ok, so lets make it really easy to find the latest third party drivers, and make a choice to install based on date, signing, Feature Score and Hardware Id match.
 
 
/drivers        [-className | -classGUID | DeviceId] [-m] [-si]
 
                -className   Display, Media, Net, System, etc.
                -classGUID   Corresponding unique Id
                -DeviceId    Device identifier in valid format (two or four part for PCI)
                -m           Hide WHQL drivers
                -si          Only display a single instance for identical device ids (removes duplicates)
 
 
So in response to the command 'verx /drivers', we get a tabular report for each matching hardware Device Id, like this:
 
 
DeviceId   :  <device-ID>\<instance-specific-ID>
DeviceDesc :  "Device description string"
PCI/USBdata:  Bus     Device     Function
              0-255   0-31       0-7
 
 
           Date         Ver       SS   FS   IS     Provider   URL
Cur :      mm/dd/yyyy   w.x.y.z   SS   GG   THHH   Company    %windir%\System32\DriverStore\FileRepository\driver.inf_12345678
WUC :      ...                                                NewestDriverTarget
IHV :                                                         "
OEM :                                                         "
 
 
Columns are as follows:
 
           Date = Date in DriverVer key of version section of .inf
           Ver = Version in DriverVer key of version section of .inf
           SS = Signature Score
           FS = Feature Score
           IS = Identifier Score
           Provider = Driver publisher
           URL = Driver Store path or hyperlink to driver download
 
Rows are as follows:
 
           Cur = Currently installed driver.
           WUC = Windows Update Catalog. Latest WHQL signed driver
           IHV = Independant Hardware Vendor driver. Produced by chip manufacturer
           OEM = Original Equipment Manufacturer driver. Produced by card or motherboard manufacturer.
 
 
No doubt keeping a database of URLs of latest drivers for the vast number of hardware devices that Windows supports would require serious resources. However, having a utility that can lookup these links, might (especially with disclaimer), nicely sidestep The perilous quandary of including external drivers on the Windows CD. It might also go someway to quelling the frustrations of Jon Honeyball, who is Sick and tired of Windows.
 
Some interesting info on the dramas of driver management here: How To: Deal With Windows Drivers
It seems that 3rd-party driver update services are becoming more prevalent, and with the AllSignersEqual Group Policy now enabled by default in Windows 7, perhaps Windows Update will start to become redundant as a source for up-to-date drivers. If that is the case, Microsoft will begin to lose control of the quality of drivers installed on Windows systems.
 


Edited by Drewfus - 25 February 2011 at 12:10am
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down