thenextman
Posts: 3
Joined: Mon Apr 29, 2024 6:30 pm

Allow direct execution of installed PowerShell script

We ship a PowerShell script with our application, and we also want to run the script at install time. We want the script to execute from [APPDIR].

Using a PowerShell script custom action, we can achieve this; but the installer behaviour is to create a temporary file containing the script contents, write it to disk, execute it, and then delete the temporary file. This was causing a false positive with certain anti-virus software and breaking trust in some customer environments.

There's no custom action that lets me just "execute this PowerShell script from the place it's installed"

As a workaround, I wrapped the PowerShell in a .bat and invoke that using the "Launch File" action.
Catalin
Posts: 7513
Joined: Wed Jun 13, 2018 7:49 am

Re: Allow direct execution of installed PowerShell script

Hello,

It is indeed true that some companies have policies that do not allow a script to be executed from the %temp% folder.

However, for a "PowerShell inline script" type custom action, you can change that from the "PowerShell Script Options Dialog".
Screenshot_231.png
Screenshot_231.png (34.09 KiB) Viewed 10634 times
Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”