Table of Contents
Using win32_PnpSignedDriver class of the WMI object
To get driver versions in PowerShell, use win32_PnpSignedDriver class of the WMI object.
1 2 3 |
Get-WmiObject Win32_PnPSignedDriver| select Devicename, Driverversion, Description |
After running the command, your PowerShell should give you an output something like this:
Note how the columns are arranged as Device Name, Device Version, and Description. If you are to write the command in any sequence, the results will be the same but order will change. Here’s the output if you write it in a different order:
You can further customize the command for simplicity. For instance, remove the Description
by using:
1 2 3 |
Get-WmiObject Win32_PnPSignedDriver| SELECT Devicename, Driverversion |
OR
1 2 3 |
gwmi Win32_PnPSignedDriver| SELECT Devicename, Driverversion |
What is Get-WmiObject?
WMI means "Windows Management Instrumentation". The Get-wmi cmdlet is used to retrieve information on available WMI classes as well as instances of WMI classes.
Using Get-CimInstance cmdlet
If you have PowerShell 6.0 or above you can also use the Get-CimInstance cmdlet instead of, Get-WmiObject
.
Firstly, start by checking your PowerShell Version by using the following command:
1 2 3 |
$PSVersionTable |
You can check your version details from the following output:
If everything checks out, use the command:
1 2 3 |
Get-CimInstance win32_PnpSignedDriver |
OR
1 2 3 |
gcim win32_PnpSignedDriver |
Your PowerShell should show a similar output:
Remember that you can always filter out drivers against their versions by using SELECT.
For example:
1 2 3 |
gcim win32_PnpSignedDriver | SELECT Description, DriverVersion |
Conclusion
PowerShell essentially serves as a task automation solution. Being made of scripting language, configuration management framework, and command-line shell, you can use PowerShell to check information regarding your device alongside executing other functions.In this article, we learned the two ways of how to get driver versions in PowerShell. These methods are Get-WmiObject (gwmi) and Get-CimInstance (gcim).
Both are followed by win32_PnpSignedDriver
to retrieve information. You expand this command by using SELECT to retrieve description and driver version.
So, here’s a summary of commands:
Command | Purpose | Filters |
---|---|---|
Get-WmiObject Win32_PnPSignedDriver | Retrieve information on available WMI classes as well as instances of WMI classes. | | select Devicename, Driverversion, Description |
gwmi Win32_PnPSignedDriver | Same as above | Same as above |
Get-CimInstance win32_PnpSignedDriver | Retrieve information on CIM instances. In the end same data as WMI. | | select Devicename, Driverversion, Description |
gcim win32_PnpSignedDriver | Same as above | Same as above |
$PSVersionTable | Retrieve PowerShell Version information |
That’s all about how to get driver versions in PowerShell.