Private/Deploy/Save-MyHardware.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 |
function Save-MyHardware { [CmdletBinding()] PARAM ( [Parameter(Position = 0)] [string]$ExpandDriverPath = 'C:\Drivers' ) #=================================================================================================== # ExpandDriverPath #=================================================================================================== if (-not(Test-Path "$ExpandDriverPath")) {New-Item -Path "$ExpandDriverPath" -ItemType Directory -Force | Out-Null} #=================================================================================================== # MyHardware #=================================================================================================== Write-Verbose "Generating MyHardware ..." -Verbose $MyHardware = @() $MyHardware = Get-MyHardware #$MyHardware = $MyHardware | Sort-Object -Property DeviceID -Unique Write-Verbose "Exporting $ExpandDriverPath\MyHardware.csv ..." -Verbose $MyHardware | Export-Csv -Path "$ExpandDriverPath\MyHardware.csv" Write-Verbose "Exporting $ExpandDriverPath\MyHardware.xml ..." -Verbose $MyHardware | Export-Clixml -Path "$ExpandDriverPath\MyHardware.xml" #Write-Host "" #Write-Host "Devices:" #foreach ($HardwareDevice in $MyHardware) { #Write-Host "$($HardwareDevice.DeviceID) - $($HardwareDevice.Caption)" -ForegroundColor DarkGray #} $MyHardwareExport = "$ExpandDriverPath\MyHardware.xml" Return $MyHardwareExport } |