CreateCustomVariable

<< Click to Display Table of Contents >>

CreateCustomVariable

Creates a new custom variable in PDQ Inventory with the specified name and value. If the variable already exists, the command fails unless -Force is specified.

NOTE: This command requires a PDQ Inventory Enterprise license.

Syntax

PDQInventory CreateCustomVariable -Name <variableName> [-Value <variableValue>] [-Force]

Parameters

Parameter

Required

Description

-Name

Yes

The name for the new custom variable. Cannot be empty or contain @, $, (, or ) characters.

-Value

No

The value to assign to the variable. Defaults to an empty string if not specified. Wrap in double quotes if the value contains spaces.

-Force

No

Overwrites the variable if it already exists. Without this flag, the command exits with code 3 if the variable already exists.

Exit Codes

Code

Meaning

0

Variable created (or updated with -Force) successfully.

1

Unexpected error.

2

Invalid variable name format.

3

Variable already exists and -Force was not specified.

Examples

Create a variable with a value:

PDQInventory CreateCustomVariable -Name ScanServer -Value "\\scanserver\share"

Create a variable with an empty value:

PDQInventory CreateCustomVariable -Name EmptyVar

Create or overwrite a variable:

PDQInventory CreateCustomVariable -Name AgentVersion -Value 2.1.0 -Force

NOTE: To update an existing variable without creating it, you can also use UpdateCustomVariable.

 

 

 

© 2026 PDQ.com Corporation. All rights reserved.

PDQ.com is a trademark of PDQ.com Corporation. All other product and company names are the property of their respective owners.

Help Version: 20.0.22.0