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
Add ps exe to custom actions
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.
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.
Re: Add ps exe to custom actions
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.
SAPIEN Technologies, Inc.
-
- Posts: 21
- Last visit: Sun Jan 07, 2024 5:33 pm
Re: Add ps exe to custom actions
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.
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.
-
- Posts: 21
- Last visit: Sun Jan 07, 2024 5:33 pm
Re: Add ps exe to custom actions
Please note that I did run the installer with logging and I saw a message mentioning something like: Please insert disk.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Add ps exe to custom actions
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: And, importantly, you need to make sure you also add the file you want to execute to the installed files.
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: And, importantly, you need to make sure you also add the file you want to execute to the installed files.
- Attachments
-
- decodehr.zip
- (1.94 MiB) Downloaded 17 times
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
-
- Posts: 21
- Last visit: Sun Jan 07, 2024 5:33 pm
Re: Add ps exe to custom actions
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Add ps exe to custom actions
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.
SAPIEN Technologies, Inc.
-
- Posts: 21
- Last visit: Sun Jan 07, 2024 5:33 pm
Re: Add ps exe to custom actions
I noticed that you included the config file for the packaged app, whereas I did not. I'll try that first.
-
- Posts: 21
- Last visit: Sun Jan 07, 2024 5:33 pm
Re: Add ps exe to custom actions
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.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Add ps exe to custom actions
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.
Please also include the .psbuild file you use to create the MSI.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.