> For the complete documentation index, see [llms.txt](https://documentation.2pintsoftware.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.2pintsoftware.com/deployr/reference/task-sequence-variables/hardware-autogenerated-variables.md).

# Hardware Autogenerated Variables

The DeployR gather process is based on the process used in MDT and PSD (PowerShell Deploy), a project sponsored by 2Pint. The current gather script is available on GitHub. You can review it here:\
<https://github.com/2pintsoftware/2Pint-DeployR/blob/main/Samples/PowerShell%20Scripts/Gather-TSVariables.ps1>

These variables are created at the start of the task sequence, and you can use them in PowerShell scripts and conditions. The following list describes them:

### Chassis

**Description**: This will return the Chassis type based on the system enclosure and creates the following additional variables:

* IsDesktop
* IsLaptop
* IsServer
* IsSFF
* IsTablet

**WMI**: ClassName = Win32\_SystemEnclosure

**Returned Values**:

* Laptop \[8,9,10,11,12,14,18,21]
* Desktop \[3,4,5,6,7,15,16]
* Server \[23]
* Small Form Factor \[34,35,36]
* Tablet \[13,31,32,30]

**PowerShell Code**:

```powershell
$LocalInfo = @{}		
$LocalInfo['IsDesktop'] = "False"
$LocalInfo['IsLaptop'] = "False"
$LocalInfo['IsServer'] = "False"
$LocalInfo['IsSFF'] = "False"
$LocalInfo['IsTablet'] = "False"
Get-CimInstance -ClassName Win32_SystemEnclosure | ForEach-Object {
	if ($_.ChassisTypes[0] -in "8", "9", "10", "11", "12", "14", "18", "21") { $LocalInfo['IsLaptop'] = "True"; $LocalInfo['Chassis'] = "Laptop"}
	if ($_.ChassisTypes[0] -in "3", "4", "5", "6", "7", "15", "16") { $LocalInfo['IsDesktop'] = "True"; $LocalInfo['Chassis'] = "Desktop"}
	if ($_.ChassisTypes[0] -in "23") { $LocalInfo['IsServer'] = "True"; $LocalInfo['Chassis'] = "Server"}
	if ($_.ChassisTypes[0] -in "34", "35", "36") { $LocalInfo['IsSFF'] = "True"; $LocalInfo['Chassis'] = "Small Form Factor"}
	if ($_.ChassisTypes[0] -in "13", "31", "32", "30") {$LocalInfo['IsTablet'] = "True"; $LocalInfo['Chassis'] = "Tablet"}
}


PS C:\WINDOWS\system32> $LocalInfo

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
IsLaptop                       True                                                                                                                                                                                                                              
Chassis                        Laptop                                                                                                                                                                                                                            
IsDesktop                      False                                                                                                                                                                                                                             
IsSFF                          False                                                                                                                                                                                                                             
IsServer                       False                                                                                                                                                                                                                             
IsTablet                       False
```

### MacAddress

**Description**: Lists all MAC addresses of the device (there can be several)

**WMI**: Win32\_NetworkAdapterConfiguration

**Returned Values**: MAC Address strings

**PowerShell Code**:

```powershell
$macList = @()
Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 1" | ForEach-Object {
	$_.MacAddress | ForEach-Object { $macList += $_ }
}

PS C:\WINDOWS\system32> $macList
58:1C:F8:23:3C:0A
E0:73:E7:66:3F:A7
```

### IPAddress

**Description**: Lists all IP addresses of the device (there can be several)

**WMI**: Win32\_NetworkAdapterConfiguration

**Returned Values**: IP Address strings

**PowerShell Code**:

```powershell
$ipList = @()
Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 1" | ForEach-Object {
	$_.IPAddress | ForEach-Object { $ipList += $_ }

}

PS C:\WINDOWS\system32> $ipList
192.168.20.162
fe80::b2f6:4d89:f447:4ee3
169.254.141.136
fe80::87c2:d75a:288e:8da1
```

### DefaultGateway

**Description**: The default gateway IP address of the machine

**WMI**: Win32\_NetworkAdapterConfiguration

**Returned Values**: IP Address of gateway in string

**PowerShell Code**:

```powershell
$gwList = @()
Get-CimInstance -ClassName Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 1" | ForEach-Object {
	if ($_.DefaultIPGateway) {
		$_.DefaultIPGateway | ForEach-Object { $gwList += $_ }
	}
}

PS C:\WINDOWS\system32> $gwList
192.168.20.1
```

### OSVersion

**Description**: The version of the OS currently running

**Registry**: HKLM:System\CurrentControlSet\Control\MiniNT

**Returned Values**: WinPE, Other

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
if (Test-Path HKLM:System\CurrentControlSet\Control\MiniNT) {
	$LocalInfo['OSVersion'] = "WinPE"
}
else {
	$LocalInfo['OSVersion'] = "Other"
}

PS C:\WINDOWS\system32> $LocalInfo

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
OSVersion                      Other
```

### OSCurrentVersion

**Description**: provides the Operating System's current version

**WMI**: Win32\_OperatingSystem

**Returned Values**: OS Version Number, ex:

* 10.0.26100
* 10.0.22631
* 10.0.19045

**PowerShell Code**:

<pre class="language-powershell"><code class="lang-powershell"><strong>PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_OperatingSystem).Version
</strong>10.0.26220
</code></pre>

### OSCurrentBuild

**Description**: provides the Operating System's build version

**WMI**: Win32\_OperatingSystem

**Returned Values**: OS Build Number, ex:

* 26100
* 22631
* 19045

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber
26100
```

### Serial Number

**Description**: provides the serial number of the device

**WMI**: Win32\_BIOS

**Returned Values**: serial number string

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_BIOS).SerialNumber
5CG3160H2Z
```

### Architecture

**Description**: provides the architecture of the processor

**PowerShell**: $env:PROCESSOR\_ARCHITEW6432 or $env:PROCESSOR\_ARCHITECTURE

**Returned Values**: x64, ARM64

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
if ($env:PROCESSOR_ARCHITEW6432) {
	if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
		$LocalInfo['Architecture'] = "x64"
	}
	else {
		$LocalInfo['Architecture'] = $env:PROCESSOR_ARCHITEW6432.ToUpper()
	}
}
else {
	if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") {
		$LocalInfo['Architecture'] = "x64"
	}
	else {
		$LocalInfo['Architecture'] = $env:PROCESSOR_ARCHITECTURE.ToUpper()
	}
}

PS C:\WINDOWS\system32> $LocalInfo

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
Architecture                   x64
```

### ProcessorSpeed

**Description**: provides the max clock speed of the processor

**WMI**: Win32\_Processor

**Returned Values**: Number relating to max clock speed of processor

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_Processor).MaxClockSpeed
2600
```

### SupportsSLAT

**Description**: provides details about the Second Level Address Translation Extensions of the processor

**WMI**: Win32\_Processor

**Returned Values**: True / False

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_Processor).SecondLevelAddressTranslationExtensions
False
```

### Memory

**Description**: provides a number of calculated memory in MB

**WMI**: Win32\_ComputerSystem

**Returned Values**: Number corresponding to memory

* This value is often a little lower than the installed memory. If your device has 8 GB of RAM, the returned value is usually a bit under that, so if your own scripts check for 8 GB, allow a 1 GB buffer.

**PowerShell Code**

```
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory / 1024 / 1024
65168.2890625

```

**PowerShell Example for GB for reference**: (comes in just under the 64 that I expect)

```
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory / 1024 / 1024 / 1024
63.6409072875977

```

### Manufacturer | Make | Model

**Description**: provides the details of the device from the OEM, getting the information from a couple of locations if required.

**WMI**: Win32\_ComputerSystem & Win32\_BaseBoard

**Returned Values**: string values that correspond to details about the device's OEM information

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
Get-CimInstance -ClassName Win32_ComputerSystem | ForEach-Object {
	$LocalInfo['Manufacturer'] = $_.Manufacturer.Trim()
	$LocalInfo['Make'] = $_.Manufacturer.Trim()
	$LocalInfo['Model'] = $_.Model.Trim()
}

if ($LocalInfo['Make'] -eq "") {
	$Make = (Get-CimInstance -ClassName Win32_BaseBoard | Select-Object -ExpandProperty Manufacturer).Trim()
	$LocalInfo['Make'] = $Make
	$LocalInfo['Manufacturer'] = $Make
}

if ($LocalInfo['Model'] -eq "") {
	$LocalInfo['Model'] = (Get-CimInstance -ClassName Win32_BaseBoard | Select-Object -ExpandProperty Product).Trim()
}

PS C:\WINDOWS\system32> $LocalInfo

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
Make                           HP                                                                                                                                                                                                                                
Manufacturer                   HP                                                                                                                                                                                                                                
Model                          HP ZBook Studio 16 inch G10 Mobile Workstation PC
```

### UUID

**Description**: Universally unique identifier of the device

**WMI**: Win32\_ComputerSystemProduct

**Returned Values**: GUID String

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_ComputerSystemProduct).UUID.Trim()
B5999BAA-4FA3-4EBD-B109-EF39AF8892AA
```

### CSPVersion

**Description**: provides the Chassis System Product Version set by the OEM

**WMI**: Win32\_ComputerSystemProduct

**Returned Values**: String Value of Item(s) created by OEM

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_ComputerSystemProduct).Version.Trim()
SBKPF,SBKPFV2
```

### BaseboardProduct

**Description**: provides the Baseboard Product value created by OEM

**WMI**: MS\_SystemInformation

**Returned Values**: string, varies widely based on OEM

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName MS_SystemInformation -NameSpace root\WMI).BaseBoardProduct.Trim()
8B8F
```

### Product

**Description**: provides the Baseboard Product value created by OEM

**WMI**: Win32\_BaseBoard

**Returned Values**: string, varies widely based on OEM. HP uses this for their OEM lookups

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName Win32_BaseBoard).Product.trim()
8B8F

```

### SystemSku

**Description**: provides the System SKU value created by OEM

**WMI**: MS\_SystemInformation

**Returned Values**: string, varies widely based on OEM. Microsoft Surface and Dell use this for their OEM lookups

**PowerShell Code**:

```powershell
PS C:\WINDOWS\system32> (Get-CimInstance -ClassName MS_SystemInformation -NameSpace root\WMI).SystemSKU.Trim()
823Y4AA#ABA
```

### IsUEFI

**Description**: Whether the device started in UEFI mode

**PowerShell**: Get-SecureBootUEFI

**Returned Values**: True | False

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
try {
	Get-SecureBootUEFI -Name SetupMode | Out-Null
	$LocalInfo['IsUEFI'] = "True"
}
catch {
	$LocalInfo['IsUEFI'] = "False"
}

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
IsUEFI                         True 
```

### SetupMode

**Description**: The firmware mode the device started in

**PowerShell**: Get-SecureBootUEFI

**Returned Values**: BIOS | UEFI

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
try {
	Get-SecureBootUEFI -Name SetupMode | Out-Null
	$LocalInfo['SetupMode'] = "UEFI"
}
catch {
	$LocalInfo['SetupMode'] = "BIOS"
}

PS C:\WINDOWS\system32> $LocalInfo 

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
SetupMode                      UEFI   
```

### IsOnBattery

**Description**: Created if the device has a battery and is currently running on it. If the device does not have a battery, or is on AC power, the variable is not created.

**WMI**: Win32\_Battery

**Returned Values**: TRUE

**PowerShell Code**:

```powershell
$LocalInfo = @{}	
$bFoundAC = $false
$bOnBattery = $false
$bFoundBattery = $false
foreach ($Battery in (Get-CimInstance -ClassName Win32_Battery)) {
	$bFoundBattery = $true
	if ($Battery.BatteryStatus -eq "2") {
		$bFoundAC = $true
	}
}
If ($bFoundBattery -and !$bFoundAC) {
	$LocalInfo['IsOnBattery'] = $true
}
```

### OSSku

**Description**: Determines the Edition or SKU of Windows on the computer, info from: <https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getproductinfo>

WM&#x49;**:** win32\_operatingsystem

**Returned Values**: A number (0-85), translated to the edition name

**PowerShell Code**:

```powershell
$LocalInfo = @{}
$sku = (Get-CimInstance -ClassName win32_operatingsystem).OperatingSystemSKU
switch ($sku)
{
	0       {$LocalInfo['OSSku']="Undefined";break}
	1       {$LocalInfo['OSSku']="Ultimate Edition";break}
	2       {$LocalInfo['OSSku']="Home Basic Edition";break}
	3       {$LocalInfo['OSSku']="Home Basic Premium Edition";break}
	4       {$LocalInfo['OSSku']="Enterprise Edition";break}
	5       {$LocalInfo['OSSku']="Home Basic N Edition";break}
	6       {$LocalInfo['OSSku']="Business Edition";break}
	7       {$LocalInfo['OSSku']="Standard Server Edition";break}
	8       {$LocalInfo['OSSku']="Datacenter Server Edition";break}
	9       {$LocalInfo['OSSku']="Small Business Server Edition";break}
	10      {$LocalInfo['OSSku']="Enterprise Server Edition";break}
	11      {$LocalInfo['OSSku']="Web Server";break}
	12      {$LocalInfo['OSSku']="Datacenter Server Core Edition";break}
	13      {$LocalInfo['OSSku']="Standard Server Core Edition";break}
	14      {$LocalInfo['OSSku']="Enterprise Server Core Edition";break}
	15      {$LocalInfo['OSSku']="Storage Server Standard";break}
	16      {$LocalInfo['OSSku']="Storage Server Workgroup";break}
	17      {$LocalInfo['OSSku']="Storage Server Enterprise";break}
	18      {$LocalInfo['OSSku']="Windows Essential Server Solutions";break}
	19      {$LocalInfo['OSSku']="Small Business Server Premium";break}
	20      {$LocalInfo['OSSku']="Storage Express Server Edition";break}
	21      {$LocalInfo['OSSku']="Server Foundation";break}
	22      {$LocalInfo['OSSku']="Storage Workgroup Server Edition";break}
	23      {$LocalInfo['OSSku']="Windows Essential Server Solutions";break}
	24      {$LocalInfo['OSSku']="Server For Small Business Edition";break}
	25      {$LocalInfo['OSSku']="Small Business Server Premium Edition";break}
	30      {$LocalInfo['OSSku']="Pro Edition";break}
	40      {$LocalInfo['OSSku']="Server Hyper Core V";break}
	48	{$LocalInfo['OSSku']="Enterprise Edition";break}
	50      {$LocalInfo['OSSku']="Datacenter Server Edition";break}
	54      {$LocalInfo['OSSku']="Enterpise N Edition";break}
	62      {$LocalInfo['OSSku']="Home N Edition";break}
	65      {$LocalInfo['OSSku']="Home Edition";break}
	68      {$LocalInfo['OSSku']="Mobile Edition";break}
	79	{$LocalInfo['OSSku']="Education Edition";break}
	81	{$LocalInfo['OSSku']="Enterprise 2015 LTSB";break}
	82	{$LocalInfo['OSSku']="Enterprise 2015 N LTSB";break}
	85	{$LocalInfo['OSSku']="Mobile Enterprise";break}
	default {$LocalInfo['OSSku']="Not Supported";break}
}
PS C:\WINDOWS\system32> $LocalInfo

Name                           Value                                                                                                                                                                                                                             
----                           -----                                                                                                                                                                                                                             
OSSku                          Enterprise Edition
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://documentation.2pintsoftware.com/deployr/reference/task-sequence-variables/hardware-autogenerated-variables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
