totalnoob
Posts: 4
Joined: Wed Aug 03, 2022 2:55 pm

Button to start powershell script

Hello,
probably this got asked a lot but i could not find it. I have basic wizard with two options for user https://imgur.com/a/JMBaLw i want to have different script for each. Ive tried adding the script into published events but dont know how. Tried it with Custom actions but dont know what kind of condition should i add. https://imgur.com/Gr3nNys
Thanks for help
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Hello and welcome to our forums,

In order to achieve that, please note that you have to add your custom action as a custom action without sequence.
CAWithoutSequence.png
CAWithoutSequence.png (26.14 KiB) Viewed 5461 times

This will then allow you to add your custom action under the "Published Events" tab, as you mentioned.

How to execute a custom action when a button is pushed

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
totalnoob
Posts: 4
Joined: Wed Aug 03, 2022 2:55 pm

Re: Button to start powershell script

Thanks that works is it possible to show the powershell window during installation?
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Hello,

I am not quite sure I fully understand your request here.

Could you please give me some more details about what you would like to achieve?

Perhaps, if you can show me some screenshots, that would be even better.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
totalnoob
Posts: 4
Joined: Wed Aug 03, 2022 2:55 pm

Re: Button to start powershell script

When i click the button the script is running in background that ok but how can i show user progress. I was thinking like showing the output from the script.. When the button is clicked now the program freeze. Ive tried adding progres bar but that wont start. It would be probably hard to configure. Im using powershell to install multiple programs and features the script takes like 3-5 minutes to complete

advinst_2022-08-05_13-25-06.png
advinst_2022-08-05_13-25-06.png (104.16 KiB) Viewed 5448 times
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Hello,

I believe displaying the PowerShell script progress on a progress bar is not feasible, if not impossible.

The closest you can get would be following this article:

List main actions performed during installation into a user friendly log-like fashion

This would be the closest to what you want.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
totalnoob
Posts: 4
Joined: Wed Aug 03, 2022 2:55 pm

Re: Button to start powershell script

In progress dlg i have just the progress bar i added text box is it possible to add powershell output into it?
2022-08-05_16-22-10.png
2022-08-05_16-22-10.png (107.13 KiB) Viewed 5430 times
Catalin
Posts: 6582
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Hello,

It is not possible to add the PowerShell script code there, but it will show a little log-like list of the actions performed by the installation.

For instance, if your script takes a while to execute, it will display something like:

Code: Select all

"Executing PowerShell script"
so the user knows what is going on behind.

To achieve that, please refer to the article I've linked above.

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

Return to “Building Installers”