You are not reading the most recent version of this documentation. See the latest version available.

Run PowerShell script from MSIΒΆ

Run a PowerShell script from MSI.

Video manual:


Precondition: Open an MSI package in MSI Editor (see Open MSI/MST).

  1. First, import the PowerShell script that you need to run to MSI.
    1. Go to the Package Designer > Files and folders tab.


    2. Select Import files from the context menu where you want to import the PowerShell script.


    3. Click Add > Add files to choose the script.


    4. Choose your PowerShell script and click Open.


    5. Tick the Complete operation with default settings option and click Finish.


  2. Add custom action to run the PowerShell script.
    1. Go to the Package Designer > Custom actions tab.


    2. Select Add > Custom action from the toolbox.


    3. Select Launch an EXE and click Next.


    4. Select the Located on the system at the path, which is specified in the Command line field, in the selected working folder option and click Browse.


    5. Select a folder that contains the PowerShell script you have imported and then, click Select.


    6. Enter the powershell.exe -ExecutionPolicy Bypass -File "<script file name>.ps1" to Command line, where <script file name> is replaced with a name of your PowerShell script (e.g. psscript.ps1). Then, click Next.



      -ExecutionPolicy Bypass parameter is added to make sure that the custom action will always execute regardless of the current execution policy on the system.

    7. Select the Deferred execution mode, and the Run in system context option. From the Return processing options list, choose An asynchronous execution that waits for exit code at the end of the sequence, and click Next.


    8. From the Execution sequence (recommended) list, select Run after InstallFiles (or any other position located below). If needed, specify the execution conditions - enter them manually or choose from the dropped list. Then, click Finish.



PACE Suite covers the whole range of application packaging tasks - learn more.

Try PACE Suite for free - 30 days no obligations unlimited trial with all functions unlocked.