MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Inline PowerShell can't pass or access properties

Wed Dec 06, 2023 9:18 pm

Following multiple guides and posts and neither is working for me. Included screenshot.

Here is the Parameter values text:

"--productName [ProductName]"

Here is the script code:

Code: Select all

Param($productName)

echo $productName

$appDir1 = AI_GetMsiProperty APPDIR

echo $appDir1
Thanks

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 6:12 am

Output:

Return code: 0

Script output: "--productName
"

Liviu
Posts: 1004
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 8:25 am

Hello,

Please take a look at our Getting a property value into a script (for deferred custom actions) article.

Code: Select all

-firstPsParam [FIRST_MSI_PROP]
If your property contains spaces, you must include it in quotation marks:

Code: Select all

-productName "[ProductName]"

If you still can't get this to work, please send us the .AIP (setup project) file by email to support at advancedinstaller dot com so we can further test and investigate this.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 7:35 pm

My PowerShell version was 6, does this make a difference? I installed PowerShell 7 alongside but when I check $PSVersionTable.PSVersion in the inline PowerShell Action, it still says 6. How do I change the version it points to?

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 7:45 pm

Sorry, I'm on version 5 upgrading to 7

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 7:58 pm

Here's the aip file
Attachments
SIMS-Installer-AI.aip
(14.41KiB)Downloaded 362 times

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 7:58 pm

I see it's not the version, sorry, bad day

MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

Thu Dec 07, 2023 8:47 pm

Please ignore and I apologize, I figured out the issue.

Catalin
Posts: 6438
Joined: Wed Jun 13, 2018 7:49 am

Re: Inline PowerShell can't pass or access properties

Fri Dec 08, 2023 8:56 am

Hello,

Thank you for your followup on this!

We are glad everything is working as expected.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”