Skip to main content

1E 9.x (on-premises)

TSEnv2 command-line switches

TSEnv2 is an executable that can be used primarily to set or change task sequence environment variables, including "readonly" variables, those starting with an underscore, which cannot be changed with ConfigMgr's tsenv.exe tool. It also has other related functions, some of which can be performed by the NomadPackageLocator tool, refer to NomadPackageLocator.exe command-line switches for details.

TSEnv2 is installed as part of Nomad and is available with the Nomad OSD tools, so it can be included in WinPE images allowing Nomad to be used in OS Deployments, refer to Installing Nomad Branch Tools for details.

The command-line format is:

TSEnv2.exe [switch]

Where switch is one of the switches in the table below.

Note

There is no '-' or '/' before the switch.

Switch

Description

dump [file]

Write a binary dump of the TS variables to a file. If no file name is given, the default is C:\tsenv2.out.

find name

Test whether the specified variable exists and has a non-empty value. If so, the return code is 0, otherwise it is 0x80070490 (2147943568) which corresponds to ELEMENT_NOT_FOUND.

get name

Get the name of the specified variable and output it in the form.name=value

The return code is 0 if the variable exists and has a non-empty value, otherwise it is 0x80070490 (2147943568) which corresponds to ELEMENT_NOT_FOUND.

get_b64 name

Like get but also decodes the variable if it is in base-64 format. (Encoded values start with "eJ".)

Note

If the resulting data is not valid text and cannot be written as such, TSEnv2 creates a binary dump file and specifies the path in its output.

get_b64z name

Like get but also decodes the variable if it is in base-64 format (encoded values start with "eJ") and uncompresses the result.

Note

If the resulting data is not valid text and cannot be written as such, TSEnv2 creates a binary dump file and specifies the path in its output.

list

Outputs every variable in the form name=value with one name-value pair per line.

listblk

Like list but uses a different block-based technique. The result is always be the same.

listx

Like list but base-64 encoded variables (encoded values start with "eJ") are also decoded and uncompressed.

set name=value

Creates or changes the named variable using the specified value. Values up to 2954 characters are supported. If the value contains embedded whitespace or quote characters, enclose the entire name=value text in quotes and double the quote characters, for example: TSEnv2.exe set "embedded=some text and a couple of ""quotes""" will result in setting variable embedded to some text and a couple of "quotes"

Note

Task sequence variables that start with an underscore ("_") are intended to be read-only. These may still be changed using, TSEnv2 but exercise caution when changing values.