Private/BETA/Import-CsvVideoIntentory.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 |
function Import-CsvVideoIntentory { [CmdletBinding()] Param ( [Parameter(Mandatory)] [string]$CsvFile ) $ImportCsvFile = Import-Csv "$CsvFile" $CsvVideoIntentory = foreach ($item in $ImportCsvFile) { $Manufacturer = $null $Vendor =$null $Device = ($item.HardwareId -split '\&SUBSYS')[0] if ($Device -match 'VEN_1002') {$Manufacturer = 'AMD'} if ($Device -match 'VEN_8086') {$Manufacturer = 'Intel'} if ($Device -match 'VEN_102B') {$Manufacturer = 'Matrox'} if ($Device -match 'VEN_10DE') {$Manufacturer = 'Nvidia'} $HardwareId = ($item.HardwareId -split '\&REV')[0] if ($HardwareId -like "*1028") {$Vendor = 'Dell'} if ($HardwareId -like "*1002") {$Vendor = 'AMD'} if ($HardwareId -like "*8086") {$Vendor = 'Intel'} if ($HardwareId -like "*102B") {$Vendor = 'Matrox'} if ($HardwareId -like "*10DE") {$Vendor = 'Nvidia'} $ObjectProperties = @{ Manufacturer = $Manufacturer Device = $Device HardwareId = $HardwareId ComputerModel = [string] $item.Model Vendor = $Vendor Description = [string] $item.Description #HardwareId = [string] $item.HardwareId Driver = $null } New-Object -TypeName PSObject -Property $ObjectProperties } $CsvVideoIntentory = $CsvVideoIntentory | Select-Object Driver, Vendor, Manufacturer, Device, HardwareId, Description, ComputerModel Return $CsvVideoIntentory } |