Install Powershell Runtime during MSI install

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
proshot78
Posts: 13
Last visit: Tue Jul 19, 2022 10:33 pm
Answers: 1
Has voted: 3 times

Install Powershell Runtime during MSI install

Post by proshot78 »

Ok, I've stumped myself yet again.
I have the correct Powershell runtime for installing my project. How do I tell the MSI to also install the Powershell Runtime during execution?

I tried using Custom Actions, but I'm afraid that didn't do the trick. What am I doing wrong here?
CustomAction.PNG
CustomAction.PNG (19.48 KiB) Viewed 5535 times
User avatar
brittneyr
Site Admin
Posts: 1165
Last visit: Thu Aug 11, 2022 8:10 am
Answers: 25
Been upvoted: 20 times

Re: Install Powershell Runtime during MSI install

Post by brittneyr »

Is the PowerShell runtime not being installed?
What errors are you receiving?

If you have packaged a script into an executable, make sure the engine PowerShell version and the runtime PowerShell version match. In this case, a PowerShell 7.2.2 engine would need to be selected to match the PowerShell 7.2.2 runtime.
Brittney
SAPIEN Technologies, Inc.
proshot78
Posts: 13
Last visit: Tue Jul 19, 2022 10:33 pm
Answers: 1
Has voted: 3 times

Re: Install Powershell Runtime during MSI install

Post by proshot78 »

I get the following error:
Powershell Issue.PNG
Powershell Issue.PNG (5.74 KiB) Viewed 5104 times
The MSI is not installing the runtime, but if I manually install the runtime it works just fine.
User avatar
Alexander Riedel
Posts: 8042
Last visit: Mon Aug 15, 2022 11:28 am
Answers: 12
Been upvoted: 25 times

Re: Install Powershell Runtime during MSI install

Post by Alexander Riedel »

According to your screenshot you try to or are installing the 7.2.2 runtime. The error message indicates that you packaged your application for 7.2.4
These two do not go together. Either package for 7.2.4 and install that particular runtime or, use 7.2.2 for packaging and runtime.
Because of .NET dependencies you cannot mix and match these.
Alexander Riedel
SAPIEN Technologies, Inc.
proshot78
Posts: 13
Last visit: Tue Jul 19, 2022 10:33 pm
Answers: 1
Has voted: 3 times

Re: Install Powershell Runtime during MSI install

Post by proshot78 »

Alexander Riedel wrote: Wed Jun 15, 2022 12:34 am According to your screenshot you try to or are installing the 7.2.2 runtime. The error message indicates that you packaged your application for 7.2.4
These two do not go together. Either package for 7.2.4 and install that particular runtime or, use 7.2.2 for packaging and runtime.
Because of .NET dependencies you cannot mix and match these.
I have the 7.2.2 runtime selected for the package. When I manually install the 7.2.2 runtime, the program runs without issues. When I do not manually install the 7.2.2 runtime before running the program, I get the above error message.
User avatar
Alexander Riedel
Posts: 8042
Last visit: Mon Aug 15, 2022 11:28 am
Answers: 12
Been upvoted: 25 times

Re: Install Powershell Runtime during MSI install

Post by Alexander Riedel »

Oh I see. You have 7.2.4 installed, hence the need for a runtime.
Can you run the MSI with a log to see why the runtime/custom action is not completing?
Alexander Riedel
SAPIEN Technologies, Inc.
proshot78
Posts: 13
Last visit: Tue Jul 19, 2022 10:33 pm
Answers: 1
Has voted: 3 times

Re: Install Powershell Runtime during MSI install

Post by proshot78 »

My apologies for the delayed response!

I am running it against a different machine now, that doesn't have Powershell 7 installed. The MSI is not installing the Powershell 7.2.2 runtime, and I get the following error:
Powershell Issue.PNG
Powershell Issue.PNG (2.94 KiB) Viewed 4765 times
I'm not sure how to enable MSI logging (or know where they are stored), do you have any advice for me there?
User avatar
Alexander Riedel
Posts: 8042
Last visit: Mon Aug 15, 2022 11:28 am
Answers: 12
Been upvoted: 25 times

Re: Install Powershell Runtime during MSI install

Post by Alexander Riedel »

Please see
https://docs.microsoft.com/en-us/window ... ds/msiexec
It lists all command line options for msiexec, including logging
Alexander Riedel
SAPIEN Technologies, Inc.
Locked