- Revenera Community
- InstallShield Forum
- Custom Action - Powershell script (SUPPORTDIR files not accessible)
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page
Custom Action - Powershell script (SUPPORTDIR files not accessible)
I am trying to add a custom action (Powershell script) in my project (Picture 1 in the attached document). I have the required PowerShell script included under Support Files (Picture 2). I am unable to use the Support Files location when adding the custom action (Picture 3). I get an invalid file name error (Picture 4).
Thank you for your post.
Which project type are you using? Basic MSI? InstallScript MSI? The project type should be indicated in square brackets on the InstallShield title bar when your affected project is open in the InstallShield IDE: [<Project Type>]
Support Files (referenced by the public MSI property SUPPORTDIR) is used for including files with the installer that are temporarily extracted to the temp (temporary) folder, for use during install, but never installed. The public MSI property SUPPORTDIR does not get a value until runtime, during the installation itself. However, when you are configuring your PowerShell custom action, the InstallShield project needs to be able to retrieve the PowerShell script .ps1 file immediately at that time. Using SUPPORTDIR to reference the PowerShell script .ps1 file location is not supported; SUPPORTDIR does not have a value at that time, namely, at design-time, only at runtime, during the install itself.
When you first add a PowerShell custom action, you have two options:
Stored in Binary table - This means that the PowerShell script .ps1 file is built into the installer, but never installed. I believe this is the option that you want. The PowerShell script .ps1 file will not be installed, if you select this option, which is what happens with files in SUPPORTDIR.
Installed with product - This means that the PowerShell script .ps1 file is installed to the target machine then run from the target machine.
Please give the Stored in Binary table option a try, rebuild the project, then retest the issue. Does this option work for you?
Please let us know if you have any questions or concerns. Thanks!
Thank you so much for the reply, Ian.
I'm using a Basic MSI Project.
Stored in Binary Table is the option that I have picked when I added the custom action. The part where I am struggling with is the File Name. I was trying to reference a file that is under Support files here. I have used files under Support Files for other custom actions (Command line) without any issues. I was trying to understand why I couldn't use it for a powershell script. From what you described looks like I will have to include a physical copy of the powershell script file along with my installer, inorder for the custom action to get to the path (though its not being installed) and I am trying to avoid that scenario where I have to include the file along with the installer (as a separate file). I have screenshots of what I am doing in my original post, if you would like.
You are very welcome, @vemulapa. I am happy to help.
My understanding is that you are using a Basic MSI Project.
Do you have a support ticket (case) open with us about this issue? If so, let's continue this conversation via the case. If not, as long as you have an active support contract, could you please call our Support Team at (877) 279-2853 or email our Support Team at firstname.lastname@example.org to open a case for further assistance? This will allow us to best track this issue and best assign troubleshooting resources in order to provide you with the best technical support experience.
Yes, I have a case open (02657790)
Thank you for your reply.
Yes, let's continue our conversation via case# 02657790. As in, let's continue our discussion with replies to case# 02657790 directly.
Please let us know via case# 02657790 if you have any questions or concerns.