-
Notifications
You must be signed in to change notification settings - Fork 0
/
Get-AllDrivers.ps1
70 lines (65 loc) · 4.03 KB
/
Get-AllDrivers.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Function Get-AllDrivers {
<#
.Synopsis
This function collects driver information, and returns a PSCustomObject.
.Description
Uses WMI Win32_PnPEntity and Win32_PnPSignedDriver
.Example
# Get Intel Drivers
Get-AllDrivers | where {$_.Manufacturer -matches 'Intel'}
#>
$StatusLookup = [System.Collections.Generic.List[PSObject]]::New()
$PnPEntity = Get-CimInstance -Class Win32_PnPEntity -Filter 'ConfigManagerErrorCode = 0'
$PnPdriverAll = Get-CimInstance -Class Win32_PnPSignedDriver
$PnPdriverAll_hash = @{}
$PnPdriverAll | & {process {$PnPdriverAll_hash[$($PSItem.deviceID)] = $($PSItem) } }
$PnPEntity | foreach {
$entity = $PSItem
$myRow = [PSCustomObject]@{}
# Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name DeviceID -Value $entity.DeviceID
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name Caption -Value $entity.caption
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name Status -Value $entity.status
$PnPdriver = $PnPdriverAll_hash["$($_.deviceID)"]
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name DeviceID -Value $PnPdriver.DeviceID
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name ClassGUID -Value $PnPdriver.ClassGUID
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name CompatID-Value $PnPdriver.CompatID
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name DeviceName -Value $PnPdriver.DeviceName
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name DriverVersion-Value $PnPdriver.DriverVersion
Add-Member -InputObject $myRow -MemberType NoteProperty -Force -Name Manufacturer -Value $PnPdriver.Manufacturer
$StatusLookup.Add($myRow)
}
return $StatusLookup
} # End Function Get-AllDrivers
# SIG # Begin signature block
# MIIFwQYJKoZIhvcNAQcCoIIFsjCCBa4CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUcp0N2+170SewUmHiy+Q1Fq3z
# X5mgggNOMIIDSjCCAjKgAwIBAgIQIBPntLmZnK5B5G5IDj1xLDANBgkqhkiG9w0B
# AQsFADAoMSYwJAYDVQQDDB1wZW5ubGF3c2Nob29sLm9ubWljcm9zb2Z0LmNvbTAe
# Fw0yMjExMjExNDAzMDhaFw0zMjExMjExNDEzMDhaMCgxJjAkBgNVBAMMHXBlbm5s
# YXdzY2hvb2wub25taWNyb3NvZnQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
# MIIBCgKCAQEAmK7TlA3wGi383lYrziQmsQaC0tpReqlPxnox69vP0kj0GxIn7Xdt
# HXL29397iSofjm2p8VqwELDLd/0mNTpCtSFWXz/OMuPAuODAD0QGxp0MPzqMXPsc
# rqW5hS5vXokd4qeqTy3LosW146C6MU3AzUGgYb4gh5EPwSICXOxHipKngbzlZ9hm
# S2MuC3N6Bg7OX7QFm/MCQYeh1va5iSkwNKHZRfB2f2J08R2+DFRCBV3meQm8Y90G
# e0unV4zTWu00abgSleQChpCWh8Clyh+iQ3cns4n51aOzBBKAK1AN+uVpfcaBdZrQ
# EFp48XI+T4GpIv7mipJ1CgnI9JWxCSV25QIDAQABo3AwbjAOBgNVHQ8BAf8EBAMC
# B4AwEwYDVR0lBAwwCgYIKwYBBQUHAwMwKAYDVR0RBCEwH4IdcGVubmxhd3NjaG9v
# bC5vbm1pY3Jvc29mdC5jb20wHQYDVR0OBBYEFE/11+6yebJM38cjuiup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