How can I use PowerShell to check if a driver version available in the Windows Update (WU) catalog is newer than the installed version on a Windows device? I know I can get some info from the Windows Update Agent API, but it seems like I can't query the API for versions of specific software components available. I know that in update packages there is a version number in the title, but I understand that number is regarding the update package and not any one specific file in the package.
For example, if I have abc.inf v1.0 installed on a device, how can I check if a version greater than 1.0 is available for abc.inf? I don't necessarily need/want to install the update or file, but I can download if needed.
The API doesn't tell you about version numbers for all of the drivers (some do have it in the title), but it will only tell you about newer drivers that it has available for hardware in your system, and when those drivers were released. You can run this to find driver updates:
$WUSess = new-object -ComObject Microsoft.Update.Session
$Searcher=$WUSess.CreateUpdateSearcher()
$SearchResults = $Searcher.Search("IsInstalled=0 and Type='Driver'")
Then look at the various properties that start with 'Driver' for each result.
PS C:\Users\TMTech> $SearchResults.Updates|FT Driver*
DriverClass DriverHardwareID DriverManufacturer DriverModel DriverProvider DriverVerDate
----------- ---------------- ------------------ ----------- -------------- -------------
OtherHardware usb\vid_045e&pid_0745 Microsoft Microsoft Mouse and Keyboard Detection Driver (USB) Microsoft 5/18/2011 12:00:00 AM
OtherHardware pci\ven_8086&dev_8d3a Intel Intel(R) Management Engine Interface Intel 11/19/2017 12:00:00 AM
Video pci\ven_10de&dev_107d&subsys_094e103c NVIDIA NVIDIA NVS 310 NVIDIA 5/6/2019 12:00:00 AM