Add ps exe to custom actions

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 months and 3 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Add ps exe to custom actions

Post by Epoch55systems »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: Powershell Studio 2023
Operating system:Windows 11
PowerShell version(s):5.1

Is it possible to add a Powershell EXE that starts a Windows Forms GUI in the custom actions in the MSI Builder? I'm trying to add A GUI (ps1 converted to exe) that will allow a user to add the product key and register the product. Thank you. I have the following selections made:

File: Registerproduct.exe
Folder: INSTALLDIR
Execution time: After the system has been successfully modified (commit)
Execution Options: Wait for custom action to finish
Execution Stage: Install
Powershell Custom Actions: Do not execute profile
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Add ps exe to custom actions

Post by brittneyr »

Yes, it is possible to run a packaged script as a custom action in the MSI Builder. Are you having issues getting this to work? If so, can you please provide more detail as to what is happening when you attempt this?
Brittney
SAPIEN Technologies, Inc.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Re: Add ps exe to custom actions

Post by Epoch55systems »

Hello:
Yes, the packaged script starts a PS Windows Form (converted to an exe, and added to the Files and Folders in the MSI builder) that has input boxes for a product key, which then is registered via public API. As a test, I put a start-transcript cmdlet in the file to see if it was executing, but the transcript file did not get created. I never see the GUI start.

I also added a test ps1 file (not converted to exe) with a start-transcript and a read-host to see what would happen. I did see a PS window open and a warning message mentioning that it's running in non-interactive mode. It also started the transcript file.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Re: Add ps exe to custom actions

Post by Epoch55systems »

Please note that I did run the installer with logging and I saw a message mentioning something like: Please insert disk.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Add ps exe to custom actions

Post by Alexander Riedel »

I have cobbled together an installer (in the attached zip file) that does exactly what you seem to want to do. It executes a packaged executable.
If you care to run it, it installs some files for a product named 'TestInstaller' and it runs a packaged exe named 'Empty Form with Splash Screen.exe' which is just something I had sitting around.
Here are the settings I used for the custom action:
2023-05-23_11-19-32.png
2023-05-23_11-19-32.png (44.01 KiB) Viewed 1167 times
And, importantly, you need to make sure you also add the file you want to execute to the installed files.
2023-05-23_11-20-11.png
2023-05-23_11-20-11.png (152.2 KiB) Viewed 1167 times
Attachments
decodehr.zip
(1.94 MiB) Downloaded 17 times
Alexander Riedel
SAPIEN Technologies, Inc.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Re: Add ps exe to custom actions

Post by Epoch55systems »

Is it possible that the fact that my packaged exe waits for input could the problem? Thanks, I'll compare your settings to mine. Note that the other scripts (registry settings, etc) are working fine, but none of them require user input.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Add ps exe to custom actions

Post by Alexander Riedel »

No that should make no difference. The sample I used here stops the installer until you close it. It does not matter what you do in the application. Well, it shouldn't.
Alexander Riedel
SAPIEN Technologies, Inc.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Re: Add ps exe to custom actions

Post by Epoch55systems »

I noticed that you included the config file for the packaged app, whereas I did not. I'll try that first.
Epoch55systems
Posts: 21
Last visit: Sun Jan 07, 2024 5:33 pm

Re: Add ps exe to custom actions

Post by Epoch55systems »

I matched your config as well as added the .config file for the exe to the packager, but no difference. The file does copy over to Program files and if I run it in its destination, it works fine. I did run the installer in logging mode so I have the install log I can email to you if you like. Please advise, thanks.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Add ps exe to custom actions

Post by Alexander Riedel »

Can you upload your executable that you are trying to run here: https://www.sapien.com/support/upload ? (Zipped please)
Please also include the .psbuild file you use to create the MSI.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 10 months and 3 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.