DriverQuery - CMD


Overview

DriverQuery is a built-in Windows Command Prompt command that lists all installed drivers, their types, and associated properties. It provides vital information such as link date and driver version. This command is particularly useful for system administrators and tech support personnel for monitoring and managing driver configurations in a Microsoft Windows environment.

Syntax

The basic syntax of the DriverQuery command is:

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

Parameters:

  • /S system: Specifies the remote system to connect to.
  • /U username: Specifies the user context under which the command should execute.
  • /P [password]: Specifies the password for the given user context. This parameter is optional and will prompt for input if omitted.
  • /FO format: Specifies the output format. Valid values are TABLE, LIST, and CSV.
  • /NH: Specifies that the “Column Header” should not be displayed in the output. Useful for scripting.
  • /SI: Provides information about signed drivers.
  • /V: Specifies that verbose information is displayed.

Options/Flags

  • /S: Use this option to target a remote system for querying.
  • /U and /P: These options help in executing the command in the context of another user, typically used in conjunction with /S.
  • /FO: This is critical for determining output format, where TABLE is the default:
    • TABLE formats the display in columns.
    • LIST displays each entry on a new line.
    • CSV outputs comma-separated values, suitable for import into spreadsheets.
  • /NH: Ideal when output parsing is automated, as it removes column headers.
  • /SI: Use this to filter and display only signed drivers.
  • /V: Employ this for a detailed view, often helpful for troubleshooting or detailed reports.

Examples

Example 1: Displaying the driver details in default table format

driverquery

Example 2: Displaying driver details in CSV format without headers

driverquery /FO CSV /NH

Example 3: Viewing detailed information including signed status

driverquery /V /SI

Example 4: Querying drivers on a remote machine

driverquery /S hostname /U user /P password /FO LIST

Common Issues

  • Access Denied: When querying remote machines, ensure proper permissions. Using /U and /P with administrative credentials often resolves this.
  • Formatting Issues: When output to CSV is misaligned, check for unexpected commas in driver names or descriptions that might offset the columns.
  • Verbose Overload: Using /V can generate a lot of information; direct output to a text file using > output.txt for ease of analysis.

Integration

DriverQuery can be combined with other commands for sophisticated scripts. For instance, to extract driver information from multiple servers:

for /f %i in (servers.txt) do driverquery /S %i /FO CSV >> all_drivers.csv

Here, servers.txt contains a list of server names.

  • devmgmt.msc: Open device manager to manage drivers and hardware visually.
  • systeminfo: Provides a comprehensive system analysis including drivers loaded during boot.
  • sc query: Useful for checking the status of specific drivers if they are implemented as services.

For further reading and more detailed information, visit the official Microsoft documentation: DriverQuery.