For details of how to obtain this utility, please see Installing Nomad tools for operating system deployment.

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), but it also has other related functions.

Some functions can also be performed by the NomadPackageLocator tool.

The format of the command-line is as follows: TSEnv2.exe switch

where switch is one of the following switches.

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

SwitchDescription
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".)

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.

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.
listOutputs every variable in the form name=value with one name-value pair per line.
listblkLike list but uses a different block-based technique. The result is always be the same.
listxLike 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 examale: 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"

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.