get driver version via command line Windows

39,278

Solution 1

Is there a possibility to get the installed driver version via command line

You can use the following PowerShell Script:

Get-WmiObject Win32_PnPSignedDriver | select devicename, driverversion

Example output:

PS F:\test> Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion

devicename                                                                                          driverversion
----------                                                                                          -------------
Generic volume                                                                                      6.1.7601.17514
Generic volume                                                                                      6.1.7601.17514
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume shadow copy                                                                          6.1.7600.16385
Generic volume                                                                                      6.1.7601.17514
Generic volume                                                                                      6.1.7601.17514
Generic volume                                                                                      6.1.7601.17514
Volume Manager                                                                                      6.1.7601.17514
Microsoft Virtual Drive Enumerator Driver                                                           6.1.7601.17514
Cruzer                                                                                              6.1.7600.16385
UMBus Enumerator                                                                                    6.1.7601.17514
UMBus Enumerator                                                                                    6.1.7601.17514
UMBus Root Bus Enumerator                                                                           6.1.7601.17514
Atheros Bluetooth Bus                                                                               6.30.1208.302
Plug and Play Software Device Enumerator                                                            6.1.7601.17514
Terminal Server Mouse Driver                                                                        6.1.7601.17514
Terminal Server Keyboard Driver                                                                     6.1.7601.17514
WAN Miniport (SSTP)                                                                                 6.1.7601.17514
WAN Miniport (PPTP)                                                                                 6.1.7601.17514
WAN Miniport (PPPOE)                                                                                6.1.7601.17514

...

Solution 2

You can use VBScript or JScript to get what you want. Since you didn't say for which driver you wanted the version number, here's a batch / JScript hybrid script that dumps them all to the console for you. Save this as driverversion.bat:

@if (@a==@b) @end /*
:: batch portion

@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%I in ('driverquery /v /nh /fo csv') do (
    set idx=0
    for %%x in (%%I) do (
        set /a "idx+=1"
        if !idx!==1 (
            set /p "=%%~x version "<NUL
        ) else if !idx!==14 (
            if exist "%%~x" (
                cscript /nologo /e:jscript "%~f0" "%%~x"
            ) else echo N/A
        )
    )
)

goto :EOF

:: JScript portion */
WSH.Echo(new ActiveXObject("Scripting.FileSystemObject").GetFileVersion(WSH.Arguments(0)));

Solution 3

You can use driverquery /v to include the driver files with the listing, but AFAICS you won't be able to get the version number from the files without additional software. One tool you could use would be sigcheck from SysIntern^WMicrosoft.

@echo off

for /f "delims=, tokens=14" %%d in ('driverquery /v /nh /fo csv') do (
  for /f %%v in ('sigcheck -accepteula -q -n "%%~d"') do (
    echo %%~d %%~v
  )
)

You can't get the version out of the registry, because the information is stored in the file itself.

The link date is probably the date when the file was linked, i.e. the creation date.

Solution 4

Here an improved version to list all drivers include version using Sigcheck from Sysinternals Tools:

@echo off

for /f "tokens=* delims=" %%a in ('driverquery /v /nh /fo csv') do (
    SET str=%%a
    SETLOCAL enabledelayedexpansion
    SET str=!str:","=";"!
    for /f "tokens=1,2,14 delims=;" %%d in (!str!) do (
        ENDLOCAL
        for /f "tokens=* delims=" %%v in ('sigcheck -accepteula -q -n "%%f"') do (
            REM echo %%a,^"'%%v^"
            echo ^"%%d,%%e,%%f,^"'%%v^"
            REM echo ^"%%d,^"'%%v^"
        )
    )
)
pause

An extended version which writes the information directly to an csv file:

@echo off
set DRIVER_LOG="Drivers_%computername%.csv"

echo Drivers - %computername% - %date% > %DRIVER_LOG%

for /f "tokens=* delims=" %%a in ('driverquery /v /nh /fo csv') do (
    SET str=%%a
    SETLOCAL enabledelayedexpansion
    SET str=!str:","=";"!
    for /f "tokens=1,2,14 delims=;" %%d in (!str!) do (
        ENDLOCAL
        for /f "tokens=* delims=" %%v in ('sigcheck -accepteula -q -n "%%f"') do (
            REM echo %%a,^"'%%v^" >> %DRIVER_LOG%
            echo ^"%%d,%%e,%%f,^"'%%v^" >> %DRIVER_LOG%
            REM echo ^"%%d,^"'%%v^" >> %DRIVER_LOG%
        )
    )
)
pause

Some variants are possible...

...for all details, please use:

echo %%a,^"'%%v^"

...for more details, please use (default):

echo ^"%%d,%%e,%%f,^"'%%v^"

...for short information, please use:

echo ^"%%d,^"'%%v^"

Annotation: If you open the created csv file in Excel and want to hide the text sign ' use
Find: "'" and Replace with: "'" in Excel (Yes, it's really the same!)

This script was tested with Windows XP and Windows 7!
(For Windows XP use an older version of Sigcheck! e.g. Sigcheck v2.02)

Share:
39,278

Related videos on Youtube

user2145494
Author by

user2145494

Updated on September 18, 2022

Comments

  • user2145494
    user2145494 over 1 year

    Is there a possibility to get the installed driver VERSION via command line on a Windows 7 system.

    I've already tried driverquery but there is no information about the Version of the drivers, only a Linkdate. (By the way, what does that Link Date mean?)

    I don't want tools or programs. I need a cmd line command.

    Or can I get the version out of the registry?

  • Jason Aller
    Jason Aller about 9 years
    Which one of the fields shown with the /v option is the version of the driver?
  • DavidPostill
    DavidPostill about 9 years
    Please read the question again carefully. Your answer does not answer the original question. driverquery does not display the driver version.
  • legends2k
    legends2k over 6 years
    This works great, thanks! If you want it for a particular device, do Get-WmiObject Win32_PnPSignedDriver -Filter "DeviceName = 'NVIDIA GeForce GTX 770'" | select devicename, driverversion. I search by device name, but you can search by other fields too; do Get-WmiObject Win32_PnPSignedDriver for your options.
  • PolyTekPatrick
    PolyTekPatrick over 5 years
    I wanted to see the drivers grouped by company, so I added a sort and another column: Get-WmiObject Win32_PnPSignedDriver | Sort-Object -Property DriverProviderName, devicename | select devicename, driverversion, DriverProviderName, DriverDate Note: the additional columns will only show up if your window is wide enough (use R-click title bar > Properties > Layout > Width).
  • YePhIcK
    YePhIcK about 5 years
    Remember that you can remove the headers with ` | Format-Table -HideTableHeaders`
  • Peregrino69
    Peregrino69 over 2 years
    If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review