ad
Overview
I would find it helpful to have a batch file that automatically lists all installed drivers on Windows, including their version and INF filename. Please save the following code as a .bat file and use it.
Use Step
BAT (Batchfile)
@echo off
setlocal EnableExtensions
set "Log=%USERPROFILE%\Desktop\DriverExport_errorlog.txt"
echo ==== START %date% %time% ==== > "%Log%"
REM Variable to display the PC's hostname as part of the filename: (Variable to show the PC's hostname in the filename)
set "HostName=%COMPUTERNAME%"
echo HostName=%HostName%>>"%Log%"
echo Export the list of drivers DeviceName,DriverVersion,InfName,DeviceClass>>"%Log%"
REM Include error logging
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"Get-CimInstance -ClassName Win32_PnPSignedDriver | Select-Object DeviceName,DriverVersion,InfName,DeviceClass | Export-Csv -Path \"$env:USERPROFILE\Desktop\%HostName%_DriverList.csv\" -NoTypeInformation -Encoding UTF8" ^
>> "%Log%" 2>&1
echo ExitCode=%ERRORLEVEL%>>"%Log%"
echo ==== END %date% %time% ====>>"%Log%"
echo Logging output complete: "%Log%"
pause
endlocal
To view a list of device managers that are experiencing errors, try the following command.
BAT (Batchfile)
@echo off
echo Output a list of devices. Extract theExtract the Name,DeviceID,ConfigManagerErrorCode, field.
powershell -Command "Get-WmiObject -Class Win32_PnPEntity | Select-Object Name, DeviceID, ConfigManagerErrorCode | Export-Csv -Path "$env:USERPROFILE\Desktop\DriversErrorChk.csv" -NoTypeInformation -Encoding UTF8"
pause
echo Finished. A file has been created on the desktop. If ConfigManagerErrorCode is 0, it indicates success.ad




