Featured Resource:

line

Newsletter

Email Address:


line

Ask the Expert

Have a question for our resident expert? Email your questions to Bob or post in the Forum.

« Considering Your Upgrade Options | Main | Vista "Search Folders" »

DriverQuery

This little gem might seem like a font end to a PowerShell command, but for those not ready to bite off on PowerShell, here you go. This command line tools lets you display a list of installed device drivers. You’ll also find this in Windows 2003 and Windows XP.

DRIVERQUERY [/S system [/U username [/P [password]]]] [/FO format] [/NH] [/SI] [/V]

/S - optionally specifies a remote system to which you may connect
/U [domain\]user – optionally specifies the user context under which the command should be executed (if no domain is specified, current is assumed)
/P [password] – if specifying an alternate user, this argument may be used to specify the password for that user. If required and not specified, a password will be requested.
/FO format – optionally specifies the type of output to display (TABLE, LIST or CSV). Default is TABLE.
/NH – optionally used to indicate that a Column Header for TABLE and CSV output should not be provided
/SI – optionally provides information about signed drivers
/V - displays verbose output (not valid for signed drivers)

Comments

DriverQuery is a great command. Full Stop.

After that is said, you should still install and use PowerShell :-).

1) You can run DriverQuery from PowerShell and it gets more powerful because you can leverage Powershell's ability to script the command. e.g.
PS> driverquery /S (Read-Host "HOST") |where {$_ -match "bluetooth"}
HOST: .
BthEnum Bluetooth Request Bloc Kernel 11/2/2006 1:55:22 AM
BTHMODEM Bluetooth Serial Commu Kernel 11/2/2006 1:55:22 AM
BthPan Bluetooth Device (Pers Kernel 11/2/2006 1:55:27 AM
BTHPORT Bluetooth Port Driver Kernel 11/2/2006 1:55:21 AM
BTHUSB Bluetooth Radio USB Dr Kernel 11/2/2006 1:55:19 AM
HidBth Microsoft Bluetooth HI Kernel 11/2/2006 1:55:21 AM
RFCOMM Bluetooth Device (RFCO Kernel 11/2/2006 1:55:22 AM
PS>
(cool huh?)

2) You can also do this other ways in PowerShell and get Object results which are easier to script/manipulate/party on:

PS> gwo Win32_SystemDriver |ft ServiceType,name,DisplayName -auto

ServiceType name DisplayName
----------- ---- -----------
Kernel Driver ac97intc Intel(r) 82801 Audio Driver Install Se...
Kernel Driver ACPI Microsoft ACPI Driver
Kernel Driver adp94xx adp94xx
Kernel Driver adpahci adpahci
.....
PS> gwo Win32_SystemDriver |group ServiceType

Count Name Group
----- ---- -----
204 Kernel Driver {ac97intc, ACPI, adp94xx, adpahci, adpu1...
25 File System Driver {bowser, cdfs, DfsC, fastfat, FileInfo, ...


PS> gwo Win32_SystemDriver |where {$_.displayname -match "bluetooth"} |
>> ft name,displayname -auto
>>

name displayname
---- -----------
BthEnum Bluetooth Request Block Driver
BTHMODEM Bluetooth Serial Communications Driver
BthPan Bluetooth Device (Personal Area Network)
BTHPORT Bluetooth Port Driver
BTHUSB Bluetooth Radio USB Driver
HidBth Microsoft Bluetooth HID Miniport
RFCOMM Bluetooth Device (RFCOMM Protocol TDI)


PS> gwo Win32_SystemDriver |where {$_.displayname -match "bluetooth"} |
>> foreach {dir $_.pathname}
>>


Directory: Microsoft.PowerShell.Core\FileSystem::C:\Windows\system32\DR
IVERS


Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 11/2/2006 1:55 AM 19456 BthEnum.sys
-a--- 11/2/2006 1:55 AM 39936 bthmodem.sys
-a--- 11/2/2006 1:55 AM 92160 bthpan.sys
-a--- 11/2/2006 1:55 AM 220160 BTHport.sys
-a--- 11/2/2006 1:55 AM 29184 BTHUSB.sys
-a--- 11/2/2006 1:55 AM 29184 hidbth.sys
-a--- 11/2/2006 1:55 AM 49664 rfcomm.sys


Jeffrey Snover [MSFT]
Windows PowerShell/MMC Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Very well said! Thank you for the samples; it clearly shows how Powershell gives much more control over what you get. This command is very reminiscent of PowerShell in its style/output which is why I thought it worth mentioning.

PowerShell for Vista this month!

As Jeffrey is using a custom allias for Get-WmiObject (GWO) this might not work in your environment.

you can use the standard alias GWMI instead or the full cmdletname get-WmiObject.

or you can also add the alias by using

Set-Alias gmo get-wmiobject

Greetings /\/\o\/\/

Post a comment

(All comments are approved by site leader before appearing here. Thanks for commenting!)

Library Resources

line
line

Bob Kelly's Bio:

Bob Kelly is the founder of AppDeploy.com — a resource focused on desktop management products and practices. He is author of the Start to Finish Guide to Scripting with KiXtart and The Definitive Guide to Windows Desktop Administration. He is also president and co-founder of iTripoli, Inc. who provide AdminScriptEditor.com, home to an integrated suite of scripting tools and a shared library of scripts and language help. Not enough? For more on Bob click here.