Skip to content

Admin Script Editor > Working with Scripts Packaged with ASE

The following is indented to help answer some common questions and to help point out some key things to keep in mind when working with Packaged Scripts in Admin Script Editor (ASE)…

Packaged Script Does Not Run At All

If the script fails to run at all, you will find the reason why in the Windows Event log. On Windows NT and later systems, packaged scripts report success and failure to the Application Log.

If you have a path specified in the Process Name field, the script will fail to execute. This field should contain only the name of the interpreter itself (kix32.exe, cscript.exe, autoit3.exe, etc.)

See detailed information on the meaning of reported error codes later in this post.

Script Executes But Does Not Work As Expected

The packaged script is simply executing the specified interpreter, and does not change your script in any way. However, because the script is running from a different location than from where the package is executed, referencing other files or utilities using shell, run, etc. will need to make use of special environment variables to address external files.

When running with alternate credentials, the “current user” is that of the alternate user and not the account executing the package. To address the user profile area of the registry it is necessary to use our special environment variable in place of HKEY_CURRENT_USER references.

In both cases, using the included “Packaged Executable” script template will provide you with a good start. Below is a quick summary of the environment variables available to ASE packaged executables:

  • %ISEXE% – is equal to “1” if the script is running from within a packaged executable.
  • %ASEEXE% – is equal to the full path and filename of the packaged executable being run; use this when referencing files located alongside the packaged executable (do not specify no path, which infers “current directory”).
  • %ASEEXEPATH% – like ASEEXE, this is equal to the full path of the packaged executable being run, but ends with a backslash and does not include the executable filename in its value.
  • %ASESCRIPTPATH% – is equal to the current directory of the executing script (in its temporary location). If you wish to reference files included with your package with the “Additional Files” feature, use this variable to specify their path for Shell/Run operations.
  • %ASEEXEARGS% – equal to any arguments passed to the packaged executable when it was launched
  • %ASEHKCU% – use this in place of HKEY_CURRENT_USER when using the “Alternate Credentials” feature of the Script Packager. HKCU points to the registry of the specified alternate account credentials. Using %ASEHKCU% will reference the registry of the user executing the packaged executable (HKEY_USERS\).

Note: ASEEXEPATH and ASESCRIPTPATH both end with a backslash (careful not to include an additional backslash in your strings!)

Be sure to expand environment variables as needed. In KiXtart, using an environment variable in a string expands it to its value by default. In VBScript the following method may be used:

Set oShell = CreateObject("WScript.Shell")
 sBatPath = oShell.ExpandEnvironmentStrings("%ASESCRIPTPATH%")
 oShell.Run sBatPath & "MyIncludedFile.exe"

KiXtart and AutoIt Users

If the KiXtart (kix32.exe/wkix32.exe) or AutoIt (autoit3.exe) interpreter is not available on the system running the packaged script (in its %PATH%) you will want to include the interpreter in your package using the Additional Files option of the Script Packager.

Event Log Error Codes

Due to a lack of an installed messages DLL on client systems you will see some generic text in event log entries prior to the actual error message in the description text.

The following errors are reported if the packaged executable itself encounters a problem during execution:

  • -1 = packaged script attempted to unpack itself on a network drive (not supported)
  • -2 = packaged script could not process its configuration information (settings, paths, etc.)
  • -3 = packaged script executable is corrupt
  • -4 = packaged script attempted to apply credentials on a FAT volume
  • -5 = packaged script attempted to apply credentials on system older than Windows 2000
  • -6 = temporary target folder for script file storage is encrypted

If the package is able to run the script, but an error is returned when attempting to run your script an error of -10 is returned. A second event log entry will provide the Win32 error code that explains the error. If the error text is not included, use the Error Code Lookup utility in ASE to learn its meaning. Additionally, some commonly reported errors and explanations is provided in the ASE help file.