Created
July 7, 2023 14:37
-
-
Save SMSAgentSoftware/36fdb0cb7755b291c9784eb0df226360 to your computer and use it in GitHub Desktop.
Translates locally installed Windows update drivers to actual drivers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Driver { | |
| [string]$WUName | |
| [datetime]$InstallDate | |
| [string]$DeviceName | |
| [string]$FriendlyName | |
| [datetime]$DriverDate | |
| [string]$DriverVersion | |
| [string]$Manufacturer | |
| } | |
| $DriverList = [System.Collections.Generic.List[Driver]]::new() | |
| $InstalledDrivers = Get-Package -ProviderName msu | where {$_.Metadata.Item("SupportUrl") -match "target=hub"} | |
| foreach ($InstalledDriver in $InstalledDrivers) | |
| { | |
| $Driver = [Driver]::new() | |
| $Driver.WUName = $InstalledDriver.Name | |
| $Driver.InstallDate = [DateTime]::Parse($InstalledDriver.Metadata.Item("Date")) | |
| $DeviceDriver = Get-CimInstance -ClassName Win32_PnPSignedDriver -Filter "DriverVersion = '$($InstalledDriver.Name.Split()[-1])'" | | |
| Select -First 1 | | |
| Select DeviceName,FriendlyName,DriverDate,DriverVersion,Manufacturer | |
| If ($DeviceDriver) | |
| { | |
| try { $DriverDate = [DateTime]::Parse($DeviceDriver.DriverDate) }catch { $DriverDate = $DeviceDriver.DriverDate } | |
| $Driver.DeviceName = $DeviceDriver.DeviceName | |
| $Driver.FriendlyName = $DeviceDriver.FriendlyName | |
| $Driver.DriverDate = $DriverDate | |
| $Driver.DriverVersion = $DeviceDriver.DriverVersion | |
| $Driver.Manufacturer = $DeviceDriver.Manufacturer | |
| $DriverList.Add($Driver) | |
| } | |
| } | |
| $DriverList | Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script returns nothing for me. When I run
Get-Package -ProviderName msu | where {$_.Metadata.Item("SupportUrl") -match "target=hub"}it returns nothing. Though, if I runGet-Package -ProviderName msuit returns a bunch of security updates, mainly related to Defender. Any idea's as to why the drivers are not being reported? I am running Windows 11 23H2.