Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save SMSAgentSoftware/36fdb0cb7755b291c9784eb0df226360 to your computer and use it in GitHub Desktop.
Save SMSAgentSoftware/36fdb0cb7755b291c9784eb0df226360 to your computer and use it in GitHub Desktop.
Translates locally installed Windows update drivers to actual drivers
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