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

Button to start powershell script

Wed Aug 03, 2022 3:08 pm

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: 5172
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Thu Aug 04, 2022 10:13 am

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.14KiB)Viewed 611 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

Thu Aug 04, 2022 3:28 pm

Thanks that works is it possible to show the powershell window during installation?

Catalin
Posts: 5172
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Fri Aug 05, 2022 11:53 am

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

Fri Aug 05, 2022 12:29 pm

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.16KiB)Viewed 598 times

Catalin
Posts: 5172
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Fri Aug 05, 2022 1:50 pm

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

Fri Aug 05, 2022 3:24 pm

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.13KiB)Viewed 580 times

Catalin
Posts: 5172
Joined: Wed Jun 13, 2018 7:49 am

Re: Button to start powershell script

Wed Aug 10, 2022 10:54 am

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”