Execution of packages via Ivanti DSM
Execution of packages via Ivanti DSM
In the "Misc\Ivanti DSM Wrapper" subdirectory of the installation directory, you will find an exported DSM Package Template (DSM version 2021.1), which you can use if you want to distribute packages created using the Packaging PowerBench over your existing DSM infrastructure.
The advantage over simply calling "DeployApplication.exe" within an "ExecuteEx" or "RunAs" command is that you can use values of DSM variables, schema extensions, ODS variables and the DSM Client within your PPB scripts, just as you are used to from scripts that you call via "CallScript".
To use the template, first import it into your DSM environment. If you check "Reconstruct object path" during the import, you will find a new package template called "Call Packaging PowerBench Script from Ivanti DSM (Template)" in the path "Global Software Library > Application Library > Application Templates" after the import wizard is completed.
Note: Version 4.0 and higher of the PPB includes a new template that fixes some minor problems of the template from previous versions (see here and here). It is recommended to delete the existing template in DSM and import the template supplied with the current version into DSM. |
Note: If you are still using an older version of DSM and the import of the template therefore fails, you can duplicate the existing "System eScript Package Template" template, rename it accordingly and copy the contents of the DSM Wrapper template to the package directory. |
Now you can create a new DSM Package based on this template by selecting the previously imported package template in the New eScript Package wizard.
To execute a package created with the PPB in this context, you only have to copy the complete PPB package including all subdirectories into the "Extern$" directory of the DSM package. The wrapper PowerShell script then calls the actual PPB-script at runtime.
Note: Starting with version 3.0 of the PPB, it is possible to publish packages directly from the PPB user interface to DSM. Section Publish packages to Ivanti DSM describes the prerequisites and details the steps necessary. |
To be able to access the DSM variables within the PPB script, switch to expert mode in the PPB (see Expert mode) and insert "Get-NiVar", "Set-NiVar" or the other PowerShell commands that retrieve data from DSM or set data there. These variables are then initialized and can be used like any other variable in your PPB package.
In the example of the following screenshot, the DSM variables %CurrentServer% and the values of the %InitialMACAddress% schema property or the %SystemMaintenance.Schedule% configuration variable are read. They are then available in the PowerShell script.