Public/Get-OSDClass.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<#
.SYNOPSIS
Returns CimInstance information from common OSD Classes
 
.DESCRIPTION
Returns CimInstance information from common OSD Classes
 
.EXAMPLE
OSDClass
Returns CimInstance Win32_ComputerSystem properties
Option 1: Get-OSDClass
Option 2: Get-OSDClass ComputerSystem
Option 3: Get-OSDClass -Class ComputerSystem
 
.LINK
https://osd.osdeploy.com/module/functions/get-osdclass
 
.NOTES
19.10.1 David Segura @SeguraOSD
#>

function Get-OSDClass {
    [CmdletBinding()]
    Param (
        #CimInstance Class Name
        #Battery
        #BaseBoard
        #BIOS
        #BootConfiguration
        #ComputerSystem [DEFAULT]
        #Desktop
        #DiskPartition
        #DisplayConfiguration
        #Environment
        #LogicalDisk
        #LogicalDiskRootDirectory
        #MemoryArray
        #MemoryDevice
        #NetworkAdapter
        #NetworkAdapterConfiguration
        #OperatingSystem
        #OSRecoveryConfiguration
        #PhysicalMedia
        #PhysicalMemory
        #PnpDevice
        #PnPEntity
        #PortableBattery
        #Processor
        #SCSIController
        #SCSIControllerDevice
        #SMBIOSMemory
        #SystemBIOS
        #SystemEnclosure
        #SystemDesktop
        #SystemPartitions
        #UserDesktop
        #VideoController
        #VideoSettings
        #Volume
        [ValidateSet(
            'Battery',
            'BaseBoard',
            'BIOS',
            'BootConfiguration',
            'ComputerSystem',
            'Desktop',
            'DiskPartition',
            'DisplayConfiguration',
            'Environment',
            'LogicalDisk',
            'LogicalDiskRootDirectory',
            'MemoryArray',
            'MemoryDevice',
            'NetworkAdapter',
            'NetworkAdapterConfiguration',
            'OperatingSystem',
            'OSRecoveryConfiguration',
            'PhysicalMedia',
            'PhysicalMemory',
            'PnpDevice',
            'PnPEntity',
            'PortableBattery',
            'Processor',
            'SCSIController',
            'SCSIControllerDevice',
            'SMBIOSMemory',
            'SystemBIOS',
            'SystemEnclosure',
            'SystemDesktop',
            'SystemPartitions',
            'UserDesktop',
            'VideoController',
            'VideoSettings',
            'Volume'
        )]
        [string]$Class = 'ComputerSystem'
    )

    $Value = (Get-CimInstance -ClassName Win32_$Class | Select-Object -Property *)
    Return $Value
}