Greetings,
Product, version and build: 5.8.196
Operating system: Win10 21H1
PowerShell version(s): 5.1.19041.1237
I am new to this studio thing. But not new to IDE stuff. What I am wondering is, what is the best way to package a MSI installer and have the installer run a custom script to edit the registry? I have tried a powershell script but I can't be sure that the end user will have, Set-ExecutionPolicy, set. I then tried to run a batch file but I don't think the batch file has the correct permissions either on the install. Same goes for a VB.net exe to edit the registry. So I am curious what is the best way to do this? Am I just missing a setting in Studio to make it happen? Any setting I use under Custom Actions always stops on check code and errors out stating a program required for this install to complete could not be run.
Running 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: Running Custom Actions
You can always package your PowerShell script as an executable with our packager. I'm not sure how you have your settings configured, but if your MSI is running as an administrator, any custom actions will also run as an administrator.
Based on the error you are getting, does your script require any of the files that are being installed with MSI? When is your custom action executing (immediately, when the system is being modified, during installation rollback, or after the system has been successfully modified)?
Does the file you are attempting to run as a custom action work outside of the MSI?
Based on the error you are getting, does your script require any of the files that are being installed with MSI? When is your custom action executing (immediately, when the system is being modified, during installation rollback, or after the system has been successfully modified)?
Does the file you are attempting to run as a custom action work outside of the MSI?
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Running Custom Actions
Thanks Brittneyr,
Yes, it is running as administrator. Yes the script runs great outside of the installer, if I run it as administrator. I have tried the three settings, (immediately, when the system is being modified, and after the system has been successfully modified). I have tried 3 different methods. A cmd batch file, a ps1 file and a vb.net exe file with no luck. I see the command window and the powershell window open and close real fast but the reg setting never gets set.
Yes, it is running as administrator. Yes the script runs great outside of the installer, if I run it as administrator. I have tried the three settings, (immediately, when the system is being modified, and after the system has been successfully modified). I have tried 3 different methods. A cmd batch file, a ps1 file and a vb.net exe file with no luck. I see the command window and the powershell window open and close real fast but the reg setting never gets set.
No, it runs independent.Based on the error you are getting, does your script require any of the files that are being installed with MSI?"
Re: Running Custom Actions
The following article includes an example of custom actions to set and remove the registry values:
https://www.sapien.com/blog/2018/02/26/ ... i-builder/
The article is older and says its for PrimalScript, but it is still applicable.
https://www.sapien.com/blog/2018/02/26/ ... i-builder/
The article is older and says its for PrimalScript, but it is still applicable.
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Running Custom Actions
Yeah I read that page and downloaded the files. I set mine Actions up just like yours and set my script just like your setvalue script and still no dice, still doesn't add the reg key. The powershell screen comes up and goes away real fast. I'm trying to add a key here
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Running Custom Actions
This may sound like a silly question, but I ask anyway:
Did you actually add the script the custom action is supposed to run to your installer?
Did you actually add the script the custom action is supposed to run to your installer?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Running Custom Actions
Not a silly question Alexander, lol
Yes, I added it and have it set to "when the system is being modified, Wait for custom action to finish, and checked for install and Maintenance". Is there another spot beside Custom Action?
[edit]
I did just try to add my .net version of adding the reg key and added it to the files and folders section as well and this time I get no permissions to edit registry. so that means the custom action is not being run as admin
Yes, I added it and have it set to "when the system is being modified, Wait for custom action to finish, and checked for install and Maintenance". Is there another spot beside Custom Action?
[edit]
I did just try to add my .net version of adding the reg key and added it to the files and folders section as well and this time I get no permissions to edit registry. so that means the custom action is not being run as admin
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Running Custom Actions
That all depends on your settings. Can you share the PSBuild file?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8479
- Last visit: Thu Mar 28, 2024 9:29 am
- Been upvoted: 37 times
Re: Running Custom Actions
I am also not sure what you mean by "add my .net version of adding the reg key". Can you elaborate please?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Running Custom Actions
Sure, I made a VB.NET script to edit the registry so it was all incapsulated. It is very basic, tells me it did edit the registry or it did not edit it.
Last edited by B Daring on Tue Jan 11, 2022 9:34 am, edited 1 time in total.