private/dev/Get-MyDeviceModel.ps1
|
function Get-MyDeviceModel { [CmdletBinding()] param () $deviceManufacturer = Get-MyDeviceManufacturer if ($deviceManufacturer -match 'Lenovo') { $deviceModel = ((Get-CimInstance -ClassName Win32_ComputerSystemProduct).Version).Trim() } else { $deviceModel = ((Get-CimInstance -ClassName CIM_ComputerSystem).Model).Trim() } $deviceModel = $deviceModel -as [string] if ([string]::IsNullOrWhiteSpace($deviceModel)) { $deviceModel = 'OEM' } elseif ($deviceModel -match 'OEM|to be filled') { $deviceModel = 'OEM' } return $deviceModel } |