Listing and Exporting Installed Drivers in Windows

 

As a system engineer, it is often necessary to track the drivers installed on a device and identify any drivers that may be causing issues such as blue screen of death (BSOD) or crashing. To help with this task, we can use the following PowerShell script to export a list of all the drivers installed on a Windows machine to a CSV file.

This script uses the Get-WmiObject cmdlet to query the Win32_PnPSignedDriver class from the Windows Management Instrumentation (WMI) database, which represents a device driver that has been installed and signed by the Windows Hardware Quality Labs (WHQL). The script then uses the Select-Object and Export-Csv cmdlets to select the DeviceName and DriverVersion properties of each driver and write them to a CSV file named driver_list.csv in the user's home directory (C:\Users\username). This will generate a CSV file with the list of installed drivers, which you can then use to track and troubleshoot driver-related issues on your device.

Listing Installed Drivers

To list the drivers installed on a Windows machine, we can use the Get-WmiObject cmdlet and query the Win32_PnPSignedDriver class from the Windows Management Instrumentation (WMI) database. This class represents a device driver that has been installed and signed by the Windows Hardware Quality Labs (WHQL).



Exporting to a CSV File

To export the list of drivers to a CSV file, we can use the Select-Object cmdlet to select the DeviceName and DriverVersion properties, and the Export-Csv cmdlet to write the resulting objects to a CSV file.



The Select-Object cmdlet selects the DeviceName and DriverVersion properties of each Win32_PnPSignedDriver object in the list, and the Export-Csv cmdlet writes the resulting objects to a CSV file named driver_list.csv in the user's home directory (specified using the $env:USERPROFILE environment variable). The -NoTypeInformation parameter prevents PowerShell from writing type information as the first line of the CSV file.

 

Full Script

Here is the full script that combines the two steps above: The Script






Conclusion

In this Blog, we saw how to use PowerShell to list all the drivers installed on a Windows machine and export their names and versions to a CSV file. This can be useful for tracking the drivers installed on a system or for troubleshooting driver-related issues.

I hope you found this Blog helpful! Let me know if you have any questions or comments.

Popular posts from this blog

Creating a List of Installed Applications with PowerShell