“Global Variables” in Quest ODM AD explained via Enabling Debug Logging

Quest ODM AD tool has some powerful scripting capabilities, where command line or PowerShell scripts can be created as Tasks, bundled into Actions and then executed by OnDemand Migration Agent on the Workstation. While creating such scripted Task, you may have noticed “Global Variables” option which will be described here.
Here we will give an example of how to enable Debug logging in the ODM AD, which demonstrates the use of “Global Variables” very well.

1. In Quest ODM Configurations Menu, go to Variables

  • Create your variable as you intend to use it in the script.
  • In this example we will be using PSDebugEnabled
  • Note that preceding $ in the PS variables does not need to be included here.
  • Assign the value which can be numeric / string or simply boolean like True here

Quest ODM AD Variable Assignment

Quest ODM AD Variables

2. Now when creating your scripted Task, “Global Variables” check mark can be selected (Does not have to though – read up further!)

3. If “Global Variables” check mark was selected, then clicking “Load Script Framework” will populate script template “starter” code with this variable (or really all variables you created)

4. Note, you do not need to have “Global Variables” selected for your variables to be used by the script. Code is the key! (and Variable itself of course)

  • You may simply pre-create your custom code with the proper Variable header in the external script Editor like “Visual Studio Code” and then paste here
  • In the given example, PSDebugEnabled variable will still be used by your code regardless if “Global Variables” check mark is selected or not
  • The trick with PSDebugEnabled variable itself, it’s already included into ODM AD SYSTEM scripts (ones that show up when selecting “Show System”).
  • So once you create PSDebugEnabled Variable with the value True, it then “flows” downstream and gets picked up by the ODM built in tasks, or really any task that handles it properly in the code
  • As a result, you get some nicely formatted DEBUG logs for every task executed by OnDemand Migration Agent on the Workstation
  • These logs can be found in the Agent folder under “Program Files (x86)”

Quest ODM AD Global Variables

Quest ODM AD Debug Logs

Here’s example of Auto Pilot Cleanup procedure written in the DEBUG log, which is part of Entra ID workstation migration:

Start Invoke-AutoPilotCleanup
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicy
Start Export-RegistryKey
Finish Export-RegistryKey
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyCache
Start Export-RegistryKey
Finish Export-RegistryKey
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyManagerOrder
Start Export-RegistryKey
Finish Export-RegistryKey
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotSettings
Start Export-RegistryKey
Finish Export-RegistryKey
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotTpmEnhancedLogging
Start Export-RegistryKey
Finish Export-RegistryKey
Backing up RegistryKey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\Diagnostics\AutoPilot
Start Export-RegistryKey
Finish Export-RegistryKey
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicy
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyCache
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotPolicyManagerOrder
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotSettings
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\AutopilotTpmEnhancedLogging
Removing Registry Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Provisioning\Diagnostics\AutoPilot
Finish Invoke-AutoPilotCleanup

By Alex Pavlenko