Chat now with support
Chat with Support

NOTICE! We are upgrading our support telephone services, implementing Genesys, starting the week of May 26, 2025

KACE Desktop Authority 11.3 - Getting Started Guide

Pre-Engine/Post-Engine Scripts (User Management)

Pre/Post Engine Scripts

Out of the box, Desktop Authority accommodates virtually every installation's requirements simply by filling in the blanks of the objects in the Desktop Authority Manager. While feature-rich and easy-to-use, the Manager may not provide all of the desired functionality out of the box. That's where custom scripting comes in.

Custom Scripting can be used for automated software deployment, locating and/or copying files, special-case drive mappings or to override the Manager settings.

Custom scripting is relatively easy and can be as simple or complex as necessary -- though it does require programming knowledge in KiXtart, PowerShell or VBScript and often requires a working knowledge of the Windows registry. Custom scripts contain scripting code and may launch additional executables, batch files, or scripts of any type using the "shell" or "run" commands.

Note: Documentation about the KiXtart scripting language can be found at KiXtart.org, the official home of KiXtart.

Pre-engine custom scripts are launched after Desktop Authority's defined configuration settings are read into memory but before these configuration settings are applied. This allows you to "override" variables defined by Desktop Authority with your own custom settings.

Post-engine custom scripts are launched after the Desktop Authority Engine processes the Manager defined configuration settings. This allows you to use drive mappings and other configuration settings after Desktop Authority has applied them to the client.

Custom scripts

A custom script is an ASCII text file written using a scripting language. Desktop Authority supports KiXtart (.kix), PowerShell (.ps1) and VBScript (.vbs). A script may be created using Notepad or any other text editor. The script file may be created within or outside of the Manager.

To create a script from within the manager

  1. Decide at which point the script should run, Pre or Post Engine. Create the element by clicking Add inside the element list on the Pre/Post-Engine Scripts object.
  2. Specify a script file name on the Settings tab. The file name should end with a .kix, .ps1 or .vbs extension depending on the type of script being created. Once the extension is recognized by the Manager, the Edit file button will be enabled.
  3. Click the Edit file button and the new script file will be created and opened within the custom script editor.

Note: If creating a .kix script, be sure to leave all of the default contents of the script file intact and enter your script code between the comment lines.

  1. Click the Save button to save your changes or the Cancel button to abort your changes.

To modify an existing script from within the Manager

  1. Select either the Pre or Post Engine Scripts object and then the element to be modified. Click the Edit button.
  2. Once the element is open, click the Edit file button to open the custom script file in the editor. You may now make any necessary changes to the script.

Note: Keep in mind that the script file may also be edited in any other appropriate editor you see fit outside of the Desktop Authority Manager.

  1. Click the Save button to save the changes or the Cancel button to abort the changes.

Using an existing script created outside of the manager

Note: To create a script outside of the Manager, simply load any appropriate text editor and begin typing. Once the script is complete (and tested) it may be added to the Pre and/or Post-Engine object within the Manager.

  1. Create or modify the Pre/Post-Engine script element.
  2. Once the script element is open, click the Browse button to locate the file with the resource browser.
  3. Click Open to select the file once it is located.
  4. Click the Save button to save the changes or the Cancel button to abort the changes.
Custom Script execution

As Desktop Authority processes the custom script elements defined by the Pre and/or Post Engine Script list, Validation Logic is applied to each script, beginning with the element at the top of the list. Prioritize the list entries by selecting one or more entries and clicking the Up or Down buttons to reorganize the list.

Figure 26: Set the order of the script entries for execution

Settings

Pre/Post-engine scripts settings
File name

Enter the name of the custom script file. The script file name must have an extension of .kix, .ps1 or .vbs. Click Browse to locate and select an existing script file from a network share. If the file does not already exist, Desktop Authority allows the creation of scripts directly from this dialog box. Once a file name with a recognizable extension ( .kix, .ps1, .vbs) is entered into the file name field the file may be edited. Click the Edit file button to edit it. The file will be created and/opened for edit in the system editor. If a new script is being created, some comments are automatically added to the file by Desktop Authority.

Dynamic Variables

Dynamic variables, environment variables or macros may be used as part of the custom script file name. These variables are translated during the client logon process.

Example:

File name: $UserId.kix                

For the user Mary Jones, this will translate into mjones.kix when she logs on.

To insert a dynamic variable, press the F2 key and select the variable from the popup list. The dynamic variable will be inserted into the field at the cursor’s current position.

Dynamic variables may also be used as part of the content of a custom script. In order to use the Desktop Authority Dynamic variables within a PowerShell script, use $DA.davariablename. For example, if you wanted to enumerate the user's UserID, the dynamic variable is $UserID. You would format the variable as $DA.UserID in the PowerShell script.

In order to use dynamic variables in a VBScript use DA_davariablename. For example, if you wanted to enumerate the user's fullname, the dynamic variable is $FullName. You would format the variable as DA_FullName in the VBScript.

Administrative rights

Powershell and VBScripts may be run with Administrative rights by using the /admin switch following the file name.

Important: The administrative rights switch (/admin) cannot be used with a KiXtart (.kix) script since Desktop Authority already provides API functions that are executed with admin rights. Standard KiXtart functions do not use administrative rights.

Example:

scriptname.ps1 /admin

scriptname.vbs /admin

\\servername\sharename\scriptname.ps1 /admin

\\servername\sharename\scriptname.vbs /admin

IMPORTANT: When using the administrative rights switch (/admin) to execute a PowerShell or VBScript, the any Desktop Authority dynamic variables used will be evaluated based on the context of the user logging in. However, if PowerShell or VBScript variables are used within the script, they will be evaluated based on the context of the Desktop Authority Client Service user account.

There are not many rules about editing custom scripts, however, remember that each KiXtart script must end with a RETURN statement so that control is returned to the Desktop Authority Engine when the script is finished processing. This is not the case for Powershell and VBscripts.

Desktop Authority provides no error control over custom scripting. A syntax error in a custom script may cause Desktop Authority to unexpectedly terminate.

Note: Quest does not offer support for writing, modifying or troubleshooting custom scripts.

Validation Logic

Select the Validation Logic tab to set the validation rules for this element.

Notes

Select the Notes tab to create any additional notes needed to document the profile element.

Description

When adding or modifying a profile object element, the description appears above the settings tab. Enter a description to annotate the element. The default value for new profile elements can be changed by going to the system Preferences.

Related Documents

The document was helpful.

Select Rating

I easily found the information I needed.

Select Rating