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

Inline PowerShell can't pass or access properties

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

Output:

Return code: 0

Script output: "--productName
"
Liviu
Posts: 1188
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Inline PowerShell can't pass or access properties

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

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

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

Here's the aip file
Attachments
SIMS-Installer-AI.aip
(14.41 KiB) Downloaded 947 times
MercuryMage
Posts: 11
Joined: Wed Mar 08, 2023 5:21 pm

Re: Inline PowerShell can't pass or access properties

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

Please ignore and I apologize, I figured out the issue.
Catalin
Posts: 7030
Joined: Wed Jun 13, 2018 7:49 am

Re: Inline PowerShell can't pass or access properties

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”