Public/SystemInformation/Get-EZComputerManufacturer.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
<#
.SYNOPSIS
Returns the Computer Manufacturer
 
.DESCRIPTION
Returns the Computer Manufacturer
 
.LINK
https://osd.osdeploy.com/module/functions/system-information/get-ezcomputermanufacturer
 
.NOTES
21.1.28 Initial Release
#>

function Get-EZComputerManufacturer {
    [CmdletBinding()]
    Param ()

    begin {
        $Manufacturer = Get-CimInstance -ClassName CIM_ComputerSystem -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Manufacturer
    }
    process {
        if ($null -eq $Manufacturer) {$Manufacturer = 'Unknown'}
        elseif ($Manufacturer -eq '') {$Manufacturer = 'Unknown'}
        elseif ($Manufacturer -match 'Dell') {$Manufacturer = 'Dell'}
        elseif ($Manufacturer -match 'Lenovo') {$Manufacturer = 'Lenovo'}
        elseif ($Manufacturer -match 'Hewlett Packard') {$Manufacturer = 'HP'}
        elseif ($Manufacturer -match 'HP') {$Manufacturer = 'HP'}
        elseif ($Manufacturer -match 'to be filled') {$Manufacturer = 'Generic'}
    }
    end {
        Return $Manufacturer
    }
}