Reference: Variables and advanced customization

Each OS bundle contains a list of key value pairs, which are settings that control the flow or processing of the OS bundle itself. In addition to the predefined settings listed in Provision key value pair options, you can also add custom variables. These custom variables are not used by the default Tanium Provision scripts, but they can be combined into variables that are used by the scripts, or they can be used in your own scripts.

Provision key value pair options

The following key value pair options are configurable in OS bundles. The key value pairs support variable substitution. For example, %manufacturer% in the ComputerName key might be changed to Dell Inc.

If you want to prompt for a user to enter or select values for any keys instead of configuring set values, see Prompt for information during deployment.

Key

Description

AdminPassword

The password for the local Administrator account.

Note: -%serial% is automatically appended to the end of the password.
Important: Disable the built-in local Administrator account or change the local Administrator account password after Tanium provisions the endpoint. If you use the ODJ service, the provisioned endpoint automatically disables the local Administrator account after it successfully joins the domain.

BitLocker

(Windows) A value to enable BitLocker drive encryption during pre-provisioning, prior to the OS image being applied. If the value XTS-AES-256 is specified, the encryption level is set to that value before initializing BitLocker encryption on the device. Any other value encrypts the drive using the default XTS-AES-128 encryption.

If a value is not specified, BitLocker pre-provisioning is not performed and the drive is unencrypted.

Note: This value enables BitLocker drive encryption but does not configure key protectors. After OS deployment, use a BitLocker management tool, such as Tanium Enforce, to configure BitLocker. A management tool helps create and store recovery keys in escrow before enabling key protectors.

ComputerName

The computer name is set to the value that you specify. You can also use variable substitution, such as TAN-%rand:10% to generate a name with ten random digits, or more complex names like A-%manufacturer:3%-%serial:-5% to generate a name where the first three characters of the manufacturer are inserted with the last five characters of the serial number.

Tip: Do not use this format for virtual machines.

If a value is not specified, the computer name is randomly generated.

For more information, see Read-only variables.

DirectDownload

(Windows) A JSON string of properties to download Windows system OS image files directly from Microsoft.

For more information, see Download Windows files directly from Microsoft.

Note: You still need to upload a WIM file in the OS image WIM section of step 3 to save the bundle. You can upload a dummy WIM file.

DomainName

(Windows) If an ODJService value is specified, specify the domain to join.

Migrate

(Windows) For an OS refresh, specify no to skip the USMT capture/restore.

ODJAppend

(Windows) Enter false to not add a numeric suffix to the specified computer name. If the computer name already exists, the ODJ request fails with an error.

ODJDC

(Windows) Specify the domain controller to use when creating the new computer. Enter the CN of the domain controller, for example, DC01 and not DC01.domain.com.

ODJRetries

(Windows) Specify the number of times to try to create the new computer object.

ODJService

(Windows) The URL of the ODJ service. For example, if you enable the ODJ service on an endpoint that is named myServer.myDomain.com, then the ODJ URL is https://myServer.myDomain.com:myPort/getblob.

If a value is not specified, domain join is not performed.

Offline Domain Join: CertTemplate

(Windows) Specify this key with the name of the certificate template to use when generating a new certificate in the ODJ blob for the computer.

For more information, see (Optional) Add certificates and group policy templates.

Note: You cannot override the Offline Domain Join: CertTemplate value with settings from an external web service. For more information about web services, see Get settings from an external web service.

Offline Domain Join: IncludeRootCerts

(Windows) Specify this key with a value of 1 to include root certificates in Active Directory in the generated ODJ blob.

For more information, see (Optional) Add certificates and group policy templates.

Offline Domain Join: PolicyNames

(Windows) Specify this key to the list of group policy objects to include in the ODJ blob for the computer.

For more information, see (Optional) Add certificates and group policy templates.

Note: You cannot override the Offline Domain Join: PolicyNames value with settings from an external web service. For more information about web services, see Get settings from an external web service.

OS Refresh: UseTaniumClient

For OS refresh bundles, specify this key with a value of Yes to download files with the Tanium Client instead of from the Provision Endpoint.

For more information, see Download OS refresh files with the Tanium Client.

OU

(Windows) If an ODJService value is specified, specify the OU where you want the device to be created, such as OU=MyComputerOU,DC=myDomain,DC=com. If a value is not specified, the default OU is used.

Important: Do not use double quotes.

RebootAndRerun

Manually specify this variable to restart and rerun the Customer.ps1 script as many times as necessary.

For more information, see Example: Restart and rerun the Customer.ps1 script.

Tags

A comma-delimited list of tags to be added to the Tanium Client during the deployment process.

If a value is not specified, only an OSD tag is added.

Timezone

(Windows) A Windows time zone string, such as Eastern Standard Time to be set on the endpoint.

WaitFor

The Provision process waits for all WaitFor conditions to be met before executing customer.ps1 or finishing the Provisioning process.

The following values are supported, and you can define multiple values separated by the pipe ( | ) character:

  • Reboot: Reboot the system and skip to the WaitFor step after reboot completes.

  • CX: (Case-sensitive) Wait for the Tanium Deploy and Tanium Patch tools to install before releasing the endpoint to the user log in screen.

  • <full-path>: Wait for a file path to exist before releasing the endpoint to the user log in screen.

For example, the following WaitFor value forces a reboot, then waits for Deploy tools and Patch tools to install, and then waits for AnyConnect.exe to be installed in the specified path:

Reboot|CX|C:\Program Files\Cisco\AnyConnect.exe

WebService

Manually specify this key to define web service calls prior to customizing OS bundle values.

For more information, see Get settings from an external web service.

WebServicePost

Manually specify this key to define web service calls after customizing OS bundle values.

For more information, see Get settings from an external web service.

Read-only variables

The following read-only OS bundle variables are automatically defined at the start of the Provision process.

Variable

Description

anchor

The URL of the Tanium PXE server that is currently in use.

asset

The asset tag of the computer.

architecture

The architecture of the computer/OS.

Example: X64, X86, or ARM64

chassis

The string representing the chassis type.

Example: DESKTOP, LAPTOP, or SERVER

chassis_type

The chassis type that is specified by WMI/DMI for the machine.

Example: 3 for desktop, 8 for laptop, or 23 for server

ExecutionPass

The number of times the Customer.ps1 script ran. This variable is automatically incremented by one each time the script is called.

For more information, see Example: Restart and rerun multiple times.

is_desktop

Set to true if the device is a desktop (based on chassis_type).

is_laptop

Set to true if the device is a laptop (based on chassis_type).

is_server

Set to true if the device is a server (based on chassis_type).

manufacturer

The manufacturer of the computer or virtual machine.

Example: LENOVO

model

The model of the computer or virtual machine.

Example: Latitude E5400

refresh

When set to true, specifies a refresh deployment. The existing OS is wiped and a new OS is applied.

serial

The serial number of the computer.

uefi

Specifies whether the computer is using UEFI (true) or not (false).

uuid

The SMBIOS UUID (a GUID that uniquely identifies the device, assigned by the manufacturer) of the computer.

version

The version field from SMBIOS, which is often a friendly name for the specified computer model, typically on Lenovo computers.

Example: ThinkStation P620 (where the model is 30E0CTO1WW)

Prompt for information during deployment

If you want to prompt for values during the deployment process, click Prompt when you add a key value pair. You can then enter additional details such as label, optional help text, and select the input type which supports simple text input, dropdown lists, and checkboxes. Depending on which input type you select, you can configure the following options:

  • Text:

    • (Optional) Max Characters: The maximum number of characters allowed in the input.

    • (Optional) Validation Expression: A regular expression that defines the acceptable parameters of the input. If the user input does not match the pattern, the deployment does not continue.

  • Dropdown:

    • (Required) Values: The options available in the list.

  • Checkbox: (no additional options)

Additionally, if you select the Dropdown input type, you can select the Enable multiple value selection option to allow for multiple selections. If you want to allow only a single selection, do not select this option.

Important: Operating system refreshes do not support prompts. If you create a bundle that contains prompts (for example, ODJService requires a dropdown list selection) do not use that bundle as part of an OS refresh deployment. Instead, create a bundle that does not use prompts for OS refresh deployments.

Change the display order of bundles in the PXE boot menu

By default, OS bundles are listed in alphabetical order by bundle name in the PXE boot menu. You can change the default sort order in the Settings cog.

For more information, see Configure OS bundle behavior.

Get settings from an external web service

Provision supports getting settings through the ability to call one or more web services. These web services can take the information that is provided and return a list of additional settings or override existing settings. The following web service settings are supported:

  • Web Service URLs global setting: called prior to the display of the OS bundle list in the Tanium Provision wizard.

    Note:

    To automatically select a specific OS bundle, use the BundleID and BundleTimeout variables. Variable names are case-sensitive.

    • BundleID: The OS bundle ID to automatically select in the Tanium Provision wizard if the user does not click Choose before the BundleTimeout expires. To find the ID, go to the OS Bundles page and click Additional Data ExpandSidePanelIcon next to the OS bundle.

    • BundleTimeout: The time to allow a user to manually select an OS bundle before the specified BundleID is automatically selected. To enable the automatic selection of an OS bundle, you must specify a value greater than 0.

  • WebService bundle variable: called after selecting an OS bundle, but before any customization prompts.

  • WebServicePost bundle variable: called after the customization prompts, which enables calculations of other variables based on values that are entered by the user during customization.

These web services are specified by their URL, and the URL can contain variables. Both GET and POST methods are supported by specifying the method as a prefix to the URL. If no prefix is specified, then GET is the default method.

For a GET request, any available variable can be provided to the web service as a query parameter in the URL, so you must explicitly specify each value that the web service requires.

For a POST request, all current variables are passed to the web service as a JSON-encoded body.

Example: Two web services

If you want to call two web services, you can specify a WebService setting as follows:

https://myServer/GetSettings?model=%Model%;POST https://myServer/DoProcessing

Example: Static file

Because a web services is basically a web request that returns a JSON response, you can also use static files that are returned by a GET request. If you specify a WebService URL of https://myServer/%Model%.json and the model of the current endpoint is Virtual Machine, then Provision makes a GET request to https://myServer/Virtual Machine.json. If the web server contains a file by that name, then you can put settings in that file. For example, you can specify that all virtual machines get a specific time zone as follows:

JSON
{
	"TimeZone": "GMT Standard Time"
}

Download Windows files directly from Microsoft

For Windows bare metal or OS refresh deployments, the content for that deployment is downloaded from the Tanium PXE service, which runs on a corporate network. For deployments over the internet or in situations where the connection to the internet is faster than the connection to the Tanium PXE service, you can alternatively configure Provision to download the Windows OS system image file directly from the Microsoft Windows Update servers.

Before you begin

Ensure that you meet the following prerequisites:

  • Tanium Provision 1.3 or later is required, along with an updated ADK_<architecture>.zip file that was generated using the ADKPrep.ps1 script from that version.

  • Unauthenticated outbound Internet access to *.download.windowsupdate.com on TCP port 80 and content.tanium.com on TCP port 443 is required. If content filters, proxies, firewalls, or other security hardware or software are used to restrict Internet access in your environment, your security administrator might need to allow access.

Configure direct download

To configure direct download, modify or configure an OS bundle and specify the properties that tell Provision which OS image to download and apply.

  1. From the Main menu, go to Modules > Provision > OS Bundles.
  2. In the Key Value Entries section, click Add Key Value Pair and select DirectDownload from the Key dropdown list.
  3. For the Value field, enter the example JSON string: {"build":"<build>","arch":"<architecture>","lang":"<language>","edition":"<edition>"} where:
    • build specifies the Windows build number (example: 19044 is Windows 10 21H2 or 22000 is Windows 11 21H2)

    • arch specifies the machine architecture (x64, x86, or a64)

    • lang specifies one of the available Windows language codes (example: en-us)

    • edition specifies the edition from the downloaded image file (example: Pro, Enterprise, or Education)

      For example, {"build":"22000","arch":"x64","lang":"en-us","edition":"Enterprise"} tells Provision to automatically download the most recent image that matches the build, architecture, and language. The edition is then used to find the appropriate image index within that image: 64-bit Windows 11 21H2 Enterprise for English CPUs.

      Note: You still need to upload a WIM file in the OS image WIM section of Create a Windows OS bundle to save the bundle. You can upload a dummy WIM file.
  4. After the deployment is complete, verify the image properties.
    1. To verify which image was downloaded, check the download.log file.
    2. To verify which image index was selected, check the provision-pe.log file.

    If any errors occurred while attempting to find a direct download image, Provision automatically uses the image that is specified in the OS bundle.

Download OS refresh files with the Tanium Client

During OS refresh deployments, you can configure endpoints to use the Tanium Client to download the files instead of downloading them directly from the Provision Endpoint.

Note: Network connectivity between these endpoints and the Provision Endpoint is still required.
  1. From the Main menu, go to Modules > Provision > OS Bundles.

    To configure endpoints to use the Tanium Client for downloads, modify or configure an OS bundle and specify the OS Refresh: UseTaniumClient key value pair.

  2. In the Key Value Entries section, click Add Key Value Pair.
  3. For the Key field, select OS Refresh: UseTaniumClient.
  4. For the Value field, enter Yes.

Include custom scripts

You can include custom scripts to call automatically during the provisioning process. You can create a ZIP file that contains at least one PowerShell script file for any custom Windows content that you want to include. The main Provision scripts download and extract the contents of the ZIP file (if specified in the OS bundle) into the C:\_t folder, and then automatically run any PowerShell scripts, if found.

If you need to include a reboot in a script, use the RebootAndRerun variable instead of a command. For reboot examples, see Example: Restart and rerun the Customer.ps1 script and Example: Restart and rerun multiple times.

Important: Tanium Support provides assistance only for ensuring that a custom script executes. If you need additional assistance, see Tanium Support Objectives.
Note: Do not name your custom ZIP file scripts.zip. If your scripts require additional files, you can include those files in your custom ZIP file.

Use one or more of the following script names, depending on when you want your scripts to run:

  • Customer-PE-Pre.ps1 - called at the start of the Windows PE phase, prior to applying the OS image

  • Customer-PE.ps1 - called at the end of the Windows PE phase, after applying the OS image, injecting drivers and updates, and placing the unattend.xml in place (prior to restarting into Windows)

  • Customer-Pre.ps1 - called at the start of the Windows configuration process in the new Windows OS, but prior to installing the Tanium Client or joining the device to Active Directory or Azure AD

  • Customer.ps1 - called at the end of the Windows configuration process, as the last action before completion. If anti-tamper is enabled, the <Tanium_Client> directory is read-only. Ensure that any commands that you add to the customer1.ps1 script do not attempt to write to this directory.

Important: Any files in this custom ZIP file can overwrite any of the standard scripts from Tanium Provision.

Example: Load the TaniumOSD or TaniumClient modules

The script can load the TaniumOSD or TaniumClient modules:

CODE
Import-Module C:\_T\TaniumOSD
Import-Module C:\_T\TaniumClient

The Provision logs automatically capture a transcript of the output from the custom script.

The TaniumOSD module includes a variety of cmdlets, including some that are useful to work with variables:

  • Get-OSDVariable -Name "variableName"

    • This cmdlet returns the current value of the specified variable.

  • Resolve-OSDVariables -Value "This is a %model% computer from %manufacturer%."

    • This cmdlet returns the current value of the specified string, substituting the current values of any variable references in that string.

  • Set-OSDVariable -Name "variableName" -Value "my value"

    • This cmdlet sets the specified variable to the provided value.

  • Set-OSDProgressDisplay -Message "Currently installing something..."

    • This cmdlet changes the on-screen progress display so that the user knows what is currently happening.

The TaniumClient module also includes some useful cmdlets:

  • Add-TaniumTag -Tag "tagName"

    • This cmdlet adds a tag with the specified name.

  • Invoke-TaniumDownload -URL "https://server.com/path/file.zip" -Destination "C:\file.zip"

    • This cmdlet uses the Tanium Client API to download a file from the specified URL and then moved to the specified destination.

      Important: This URL must be on the Allowed URLs list. For more information, see Allowing Tanium Client downloads from Internet URLs.

Example: Restart and rerun the Customer.ps1 script

If you need to run the Customer.ps1 script multiple times, followed by a restart each time the script is run, you can set the RebootAndRerun variable to true:

CODE
Set-OSDVariable -Name "RebootAndRerun" -Value $true

Example: Restart and rerun multiple times

If you need to restart and rerun the script multiple times, you can set the RebootAndRerun variable each time the script runs. This value is automatically cleared by the restart process. If you need to keep track of which time the script is running, you can use the ExecutionPass variable, which is incremented by one each time the script runs.

The following example script runs a command after the initial restart:

JSON
Import-Module C:\_T\TaniumOSD
Import-Module C:\_T\TaniumClient

$pass = Get-OSDVariable -Name "ExecutionPass"
switch ($pass) {
   1 {
      Write-Host "Nothing to do in the first pass; schedule a second pass."
      Set-OSDVariable -Name "RebootAndRerun" -Value $true
   }
   2 {
      # Set computer description
      $computerDescription = Get-OSDVariable -Name "ComputerDescription"
      Write-Host "Second pass; setting computer description to $computerDescription."
      & net.exe config server /srvcomment:"$computerDescription"
   }
}

Join endpoints to Microsoft Entra ID

You can join endpoints to Microsoft Entra ID (Azure Active Directory), instead of the local Active Directory. You specify the Entra ID instance when you add a Microsoft provisioning package zip to an OS bundle.

Provision automatically applies the provisioning package during endpoint imaging. The provisioning package joins endpoints to Entra ID at first boot. When provisioning is done, users sign into the endpoints with their Entra ID accounts.

  1. Create a Microsoft provisioning package that specifies the Entra ID. For more information, see Microsoft documentation: Create a provisioning package.
  2. Zip the provisioning package. Confirm the .ppkg file is located at the root of the zip.
  3. Create a Windows OS bundle. In the Scripts and Other Files section, select the zip. In the Key Value Entries section, do not add DomainName, ODJService, or OU key value pairs.

Use Windows Autopilot deployment for existing devices

You can use Provision with Windows Autopilot to reinstall the Windows operating system on existing devices.

Be aware that if you include an Autopilot profile JSON, the Provision processes change:

  • Provision does not install Tanium Client. You must include Tanium Client in the WIM file or deploy the Client through Microsoft Intune.

  • Domain join is not performed.

  • Custom scripts Customer-pre.ps1 and Customer.ps1 do not run.

To use Windows Autopilot, you need to upload a JSON file for Autopilot profiles when you create an OS bundle.
  1. Create a JSON file for Autopilot profiles. For more information, see Microsoft documentation: Windows Autopilot deployment for existing devices: Create JSON file for Autopilot profiles.
  2. Create a Windows OS bundle. In the Scripts and Other Files section, select the JSON file.
    Tip: If necessary, change the Format type to All Files when browsing for the file.

Cache OS bundle content

When using a Provision Endpoint, content caching is advantageous in situations where the endpoint is at a location with very limited bandwidth or is connected over a metered network connection (such as a satellite).

When the Provisioning endpoints feature is enabled, the Provision Endpoint first copies the files in the <Tanium Client>\Tools\Provision\precache folder to the cache folder. Then, the Provision Endpoint downloads any missing files from Tanium, while honoring any configured bandwidth throttles.

Note: You cannot manually copy files directly into the cache folder because any files not copied there by the Provision process are automatically removed.

To prestage content to the precache folder to reduce network traffic, complete the following steps:

  1. On each Provision Endpoint where precaching is desired, create a <Tanium Client>\Tools\Provision\precache folder.

  2. From an existing Provision Endpoint, go to the <Tanium Client>\Tools\Provision\cache folder.

  3. Copy the files named with SHA-256 hashes and paste to the <Tanium Client>\Tools\Provision\precache folder on each Provision Endpoint from Step 1.

  4. If the files being precached are already assigned to this Provision Endpoint, restart the TaniumPXE service to load the files from the precache folder.