New-CMDeviceVariable

New-CMDeviceVariable

Creates a device variable.

Syntax

Parameter Set: NewByIdMandatory
New-CMDeviceVariable -DeviceId <String> -VariableName <String> [-IsMask <Boolean> ] [-VariableValue <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NewByNameMandatory
New-CMDeviceVariable -DeviceName <String> -IsMask <Boolean> -VariableName <String> -VariableValue <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: NewByValueMandatory
New-CMDeviceVariable -Device <IResultObject> -VariableName <String> [-IsMask <Boolean> ] [-VariableValue <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The New-CMDeviceVariable cmdlet creates a device variable for a device. Task sequence processing uses device variables.

Parameters

-Device<IResultObject>

Specifies a CMDevice object. To obtain a CMDevice object, use the Get-CMDevice cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DeviceId<String>

Specifies a device ID.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-DeviceName<String>

Specifies a device name. You can specify a NetBIOS name or a fully qualified domain name (FQDN).

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-IsMask<Boolean>

Indicates whether the variable value is displayed in the Configuration Manager console.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-VariableName<String>

Specifies the name of the device variable.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-VariableValue<String>

Specifies the value of the variable.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Create a device variable

This command creates a device variable for the device gateway-server.contoso.com. The variable is named ServerIPAddress and the value is set to 192.168.1.1. Setting the IsMask parameter to 0 ensures that the variable is displayed in the Configuration Manager console.

PS C:\> New-CMDeviceVariable -DeviceName "gateway-server.contoso.com" -VariableName "ServerIPAddress" -VariableValue "192.168.1.1" -IsMask 0

Get-CMDeviceVariable

Remove-CMDeviceVariable

Set-CMDeviceVariable

Get-CMDevice