private/Convert-ChassisType.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
Function Convert-ChassisType
{
    <#
    .SYNOPSIS
    Converts chassis types from hex to strings
 
    .DESCRIPTION
    Converts chassis types from hex to strings
 
    .PARAMETER ChassisType
    Provide hex representation of chassis type to convert to string value
 
    .EXAMPLE
    Convert-ChassisType -ChassisType 0x000A
 
    Description
    -----------
    Converts the chassis value of 0x000A to the string value of 'Notebook'
 
    .NOTES
    Name: Convert-ChassisType.ps1
    Author: Robert Prüst
    Module: PSP-Inventory
    DateCreated: 20-02-2019
    DateModified: 27-02-2019
    Blog: https://powershellpr0mpt.com
 
    .LINK
    https://powershellpr0mpt.com
    #>


    [cmdletbinding()]
    param (
        [int[]]$ChassisType
    )
    $List = New-Object System.Collections.ArrayList
    Switch ($ChassisType)
    {
        0x0001 {[void]$List.Add('Other')}
        0x0002 {[void]$List.Add('Unknown')}
        0x0003 {[void]$List.Add('Desktop')}
        0x0004 {[void]$List.Add('Low Profile Desktop')}
        0x0005 {[void]$List.Add('Pizza Box')}
        0x0006 {[void]$List.Add('Mini Tower')}
        0x0007 {[void]$List.Add('Tower')}
        0x0008 {[void]$List.Add('Portable')}
        0x0009 {[void]$List.Add('Laptop')}
        0x000A {[void]$List.Add('Notebook')}
        0x000B {[void]$List.Add('Hand Held')}
        0x000C {[void]$List.Add('Docking Station')}
        0x000D {[void]$List.Add('All in One')}
        0x000E {[void]$List.Add('Sub Notebook')}
        0x000F {[void]$List.Add('Space-Saving')}
        0x0010 {[void]$List.Add('Lunch Box')}
        0x0011 {[void]$List.Add('Main System Chassis')}
        0x0012 {[void]$List.Add('Expansion Chassis')}
        0x0013 {[void]$List.Add('Subchassis')}
        0x0014 {[void]$List.Add('Bus Expansion Chassis')}
        0x0015 {[void]$List.Add('Peripheral Chassis')}
        0x0016 {[void]$List.Add('Storage Chassis')}
        0x0017 {[void]$List.Add('Rack Mount Chassis')}
        0x0018 {[void]$List.Add('Sealed-Case PC')}
    }
    $List -join ', '
}