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.
This topic is 1 year and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
proshot78
Posts: 14
Last visit: Wed Aug 09, 2023 3:39 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 7336 times
User avatar
brittneyr
Site Admin
Posts: 1649
Last visit: Mon Mar 18, 2024 1:47 pm
Answers: 38
Been upvoted: 30 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: 14
Last visit: Wed Aug 09, 2023 3:39 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 6905 times
The MSI is not installing the runtime, but if I manually install the runtime it works just fine.
User avatar
Alexander Riedel
Posts: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 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: 14
Last visit: Wed Aug 09, 2023 3:39 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: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 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: 14
Last visit: Wed Aug 09, 2023 3:39 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 6566 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: 8472
Last visit: Mon Mar 18, 2024 2:59 pm
Answers: 19
Been upvoted: 37 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.
This topic is 1 year and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked