Private/Pnp/Save-OSDDriverPnp.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 |
function Save-OSDDriverPnp { [CmdletBinding()] PARAM ( [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [string]$ExpandedDriverPath, #[string]$PublishPath, [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)] [ValidateSet('Bluetooth','Camera','Display','HDC','HIDClass','Keyboard','Media','Monitor','Mouse','Net','SCSIAdapter','SmartCardReader','System','USBDevice')] [string]$OSDPnpClass, [switch]$GridView ) #=================================================================================================== # Test-ExpandedDriverPath #=================================================================================================== Test-ExpandedDriverPath $ExpandedDriverPath #=================================================================================================== # OSDDriverPnp #=================================================================================================== $OSDDriverPnp = @() $OSDDriverPnp = Get-OSDDriverPnp -ExpandedDriverPath $ExpandedDriverPath -NoHardwareIdRev -NoHardwareIdSubsys #=================================================================================================== # OSDPnpClass #=================================================================================================== if ($OSDPnpClass) {$OSDDriverPnp = $OSDDriverPnp | Where-Object {$_.ClassName -eq $OSDPnpClass}} #=================================================================================================== # Sort #=================================================================================================== $OSDDriverPnp = $OSDDriverPnp | Sort-Object HardwareId -Unique #=================================================================================================== # GridView #=================================================================================================== if ($GridView.IsPresent) {$OSDDriverPnp = $OSDDriverPnp | Out-GridView -PassThru -Title 'Select Drivers to include in the PNP File'} #=================================================================================================== # Generate Pnp #=================================================================================================== $OSDDriverPnp = $OSDDriverPnp | Sort-Object HardwareId #Write-Host "Save-OSDDriverPnp: Saving $ExpandedDriverPath\OSDDriver.drvpnp" -ForegroundColor Gray $OSDDriverPnp | Export-Clixml -Path "$ExpandedDriverPath\OSDDriver.drvpnp" #Write-Host "Save-OSDDriverPnp: Saving $ExpandedDriverPath\OSDDriver-Devices.txt" -ForegroundColor Gray New-Item "$ExpandedDriverPath\OSDDriver-Devices.csv" -Force | Out-Null New-Item "$ExpandedDriverPath\OSDDriver-Devices.txt" -Force | Out-Null Add-Content -Path "$ExpandedDriverPath\OSDDriver-Devices.csv" -Value "HardwareId,HardwareDescription" foreach ($DriverPnp in $OSDDriverPnp) { Add-Content -Path "$ExpandedDriverPath\OSDDriver-Devices.csv" -Value "$($DriverPnp.HardwareId),$($DriverPnp.HardwareDescription)" Add-Content -Path "$ExpandedDriverPath\OSDDriver-Devices.txt" -Value "$($DriverPnp.HardwareId),$($DriverPnp.HardwareDescription)" } <# if ($PublishPath) { #=================================================================================================== # Test-PublishPath #=================================================================================================== Test-PublishPath $PublishPath #=================================================================================================== # Get-DirectoryName #=================================================================================================== $DirectoryName = Get-DirectoryName $ExpandedDriverPath #=================================================================================================== # Publish-OSDDriverPnp #=================================================================================================== Write-Host "OSDDriverPnp: Saving $PublishPath\$($DirectoryName).drvpnp ..." -ForegroundColor Gray $OSDDriverPnp | Export-Clixml -Path "$PublishPath\$($DirectoryName).drvpnp" } #> } |