cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
jnehlse
Pilgrim

InstallShield 2019 R2 prerequisites for Powershell Custom Actions

I am trying to build an MSI using InstallShield 2019 R2 Professional Edition with some Powershell custom actions stored in the binary table. I have tested my PowerShell scripts successfully with multiple versions of Powershell (2.0, 3.0, and 5.0), but when I attempt to build my MSI, I get error -7141 "Error embedding file 'Powershell Script.ps1' into 'CLR File.clr'". I have searched everywhere for this error code, but only found a limited number of results. Most hits were older and referenced disabling Anti-Virus software while running the build. I am working on a corporate managed asset and do not have the ability to disable AV software to test this, but I think this should not be necessary for a valid build.

I did some digging in the CLR file and found this section:

InstallShield: [1] Name= , KCouldn't resolve assembly by name {0}aUnexpected exception in managed code helper: {0} CustomActionData 'MsiHiddenProperties 7Deferred property {0}="{1}" ******** = SIgnoring CustomActionData substring "{0}"  "Exception: {0}SUnable to load managed custom action: {0} SInvalid managed custom action description  .ps1 _Could not create Powershell script file{0}: {1} cUnable to load managed custom action assembly {0} mUnable to load managed custom action assembly {0}: {1})Loading Assembly {0} [ [# [! ]  Could   not resolve {0}; is "{1}=<path>" part of CustomActionData?% - Resolved to {0}MLoading assembly {0} from resource {1} =Loading assembly from path {0} ///EntryPoint/Dependency Resource 7//EntryPoint/SystemAssembly?Resolving assembly filekey {0}. [1] CResolving property reference {0}. -Type{0} was not found Could not load entry type {0}: {1} Method {0} was not found ICould not find entry method {0}: {1} =EntryPointInfo.Method was null HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\3\PowerShellEngine PowerShellVersion #Key doesn't exist HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\1\PowerShellEngine 2.0 PowerShell v2.0 does not appear to be installed on this machine. Unable to run PowerShell action ({0}){1} Calling method with parameters [{0}] , Managed entry point takes {0} parameters when it should take one uint   (MSIHANDLE) Managed entry point takes {0} parameters but is called with {1} Managed entry point takes 0 parameters when it should take {0}. -MsiHandle Parse Unexpected parameter type {0} encountered; passing string instead WDiscarding Out parameter {0} with value {1} Erroe {0} deleting file {1} Error {0) deleting folder {1} ProductCode UserSID  Deferred action requested property {0} not provided by CustomAction ata Error {0} //EntryPoint/@Assembly $//EntryPoint/@Type)//EntryPoint/@Method) //EntryPoint/@Return)//EntryPoint/@Script %//EntryPoint/Param -//EntryPoint/@Resource 9//EntryPoint/@ScriptResource =Resource {0}.{1} was not found

I am running 64-Bit Windows 10 with Installshield running as 32-bit. I have checked for the existence of the registry keys mentioned and only the HKEY_LOCAL_MACHINE\Software\Microsoft\PowerShell\3\PowerShellEngine PowerShellVersion exists with the data set to 5.1.17134.1. I checked the Wow6432Node key as well and see the same.

Is there a specific configuration or setting within Installshield that needs to be set to interface with my Powershell version 5, in order to build an MSI with Powershell Custom Actions?

Labels (1)
0 Kudos
2 Replies
Flexera Jenifer
Flexera

Re: InstallShield 2019 R2 prerequisites for Powershell Custom Actions

Hi @jnehlse ,

 

Few things to clarify to help you better:

 

Thanks,

Jenifer

0 Kudos
jnehlse
Pilgrim

Re: InstallShield 2019 R2 prerequisites for Powershell Custom Actions

Jenifer,
Thanks for the reply and interest in my support request. I am using PowerShell 5 on my build computer and had read the articles that you linked. I have attempted to add both the embedded system search for Powershell and an additional option to search for higher versions of PowerShell. I noted that the native system search looks for the PowerShellEngine value in the HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine key, whereas this value does not appear to exist on my computer nor the computers that I am targeting with PowerShell 3, 4 and 5 installed. I added a second system search looking in HKLM:\SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine to attempt to work around this. This installation will occur on Windows 7 computers for another 3-6 months, depending on how quickly Windows 10 can be rolled out. The default Windows 7 image only has PowerShell 2.0 installed, whereas the Windows 10 image has a mix of 3, 4 and 5.

I am using both immediate and deferred execution custom actions in my build as I am doing upfront work to identify the type of computer my package is being installed on and then modifying configuration files being installed on to the target computer as part of this package. As such, I am attempting to embed my PowerShell scripts into the binary table, so that they are immediately available for the InstallShield engine and to not have unnecessary residual files on the target workstation after the installation completes. I will look into doing this though, and executing all of these custom actions in a deferred manner, if I am unable to make it work the way I had VB Scripts working with an earlier version of InstallShield.

Thanks,
Jnehlse
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
0 Kudos