Can a Microsoft PowerShell script file be used as a installation, uninstallation, configuration or activation procedure in an ITCM software delivery package?

Document ID : KB000050972
Last Modified Date : 14/02/2018
Show Technical Document Details


Based on the fact that the Software Delivery agent is able to run DOS batch script files and dmscript script files as embedded procedures in a Software Delivery package, we may also think a script file written in Microsoft PowerShell can also be used in a Software Delivery package procedure.


Unfortunately, the Software Delivery Agent does not allow the native Microsoft PowerShell script execution, so it is not supported. In fact, when a .PS1 file (the default extension for a Microsoft PowerShell script) is provided as installation/unistallation/configuration/activation procedure an executable file type is searched and thus not found.

However, a Microsoft PowerShell script can be successfully run if invoked within a DOS batch job (.BAT or .CMD files) as if it was invoked from the command line prompt window.

For example, a PowerShell script named MyPSScript.PS1 can be executed as a Software Delivery package procedure by creating a .CMD file (for example INSTALL.CMD) with the following content:

PowerShell ./MyPSScript.PS1  %1  %2  %3  %4  %5

Where the %n added at the end of the line represents the eventual parameters the PowerShell script may receive, if any.

Then, just use the INSTALL.CMD file as embedded file for the SDO package procedure, as done with any other .CMD or .BAT file.

Note: For further information, please review the Microsoft PowerShell documentation on how to run PowerShell scripts from the command line.