Get-OSDriverPNPIDS.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
#Requires -RunAsAdministrator

<#
.LINK
 https://www.osdeploy.com/psmodule/osdrivers/
.SYNOPSIS
 Gets INF Information using Get-WindowsDriver
.DESCRIPTION
 Gets INF Information using Get-WindowsDriver
.PARAMETER Path
 Directory to search for INF files
.PARAMETER Files
 Files to Include. Default is *.inf
.EXAMPLE
 Get-OSDriverPNPIDS -Path C:\OSDrivers\Intel
 Gets information from *.inf files in C:\OSDrivers\Intel
.NOTES
    NAME:    Get-OSDriverPNPIDS.ps1
 AUTHOR:    David Segura, david@segura.org
 BLOG:    http://www.osdeploy.com
 CREATED:    02/18/2018
 VERSION:    1.1.0.2
#>


function Get-OSDriverPNPIDS
{
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory=$True)]
        [string]$Path,
        [string]$Files = '*.inf',
        [switch]$FullDetails
    )
    
    #Find the INF Files
    $a = Get-ChildItem -Path "$Path" -Recurse -Include $Files -File | Select-Object -Property FullName
    
    #Create the Array
    $f = @()
    $p = @()
    
    #Loop through all of the INF Files
    ForEach ($i in $a) {
    
        #Progress
        Write-Host "Processing: " $i.FullName
        
        #Get the Driver Information
        $f += Get-WindowsDriver -Online -Driver $i.FullName | Select-Object HardwareId,HardwareDescription,Architecture,ProviderName,Version,Date,ClassName,BootCritical,DriverSignature,OriginalFileName
    }

    foreach ($i in $f) {
        $p += $i.HardwareId + " = " + $i.HardwareDescription
    }

    if ($FullDetails) {
        $f | Out-Gridview -Title 'Get-OSDriverPNPIDS Results:'
    } else {
        $p | Out-Gridview -Title 'Get-OSDriverPNPIDS Results:'
    }
}