Powershell commands for SetProperty? - Advanced Installer Community
jlawrence
Posts: 2
Joined: Tue Mar 31, 2020 7:19 pm

Powershell commands for SetProperty?

Hi everyone!

I have a pretty simple update I need to make to our package. I've gotten it to work with Windows command line, but I can't find the correct powershell commands to complete the swap...

$advinst = New-Object -comobject AdvancedInstaller
$project = $advinst.LoadProject("D:\project\test.aip")
<Edit and output commands>
$project.Rebuild()

These are the commands I use in our shell script, but cannot find the commands for the above powershell version:

$builder /edit "D:\project\test.aip" /SetProperty GROUP="Test Group"
$builder /edit "D:\project\test.aip" /SetPackageName "Test Installer V2"
$builder /edit "D:\project\test.aip" /SetOutputLocation -buildname DefaultBuild -path "C:\project\builds\"


$builder /rebuild "D:\project\test.aip"
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell commands for SetProperty?

Hello and welcome to Advanced Installer forums,

As for this moment, our PowerShell Automation support is yet to be complete. As it is still under development, it does not offer the full support our CommandLine support offers (at least for now).

With that being said, I am afraid that not everything you can do from the CommandLine support can be achieved through our PowerShell support.

In order to set the package name, you can proceed as it follows:

- create a new variable that will hold the ProductDetails object, i.e.:

Code: Select all

$prodDetails = $project.ProductDetails
$prodDetails.Name = "Your_Name"
In what regards the property, you can proceed as it follows:

Code: Select all

$propertyComponent = $project.PropertyComponent
$myProperty = $propertyComponent.NewProperty("YOUR_PROPERTY","Your_property_value")
In what regards the Output location, unfortunately, this is not currently possible.

However, I have discussed this with the developer and I have created an improvement task. We will add the possibility to configure the Output location from PowerShell in a future version of Advanced Installer. Thank you for bringing this to our attention.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jlawrence
Posts: 2
Joined: Tue Mar 31, 2020 7:19 pm

Re: Powershell commands for SetProperty?

Thanks Catalin! That is perfect!
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell commands for SetProperty?

You are always welcome!

I am glad I could help.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Catalin
Posts: 7852
Joined: Wed Jun 13, 2018 7:49 am

Re: Powershell commands for SetProperty?

Hello,

This improvement has been implemented in Advanced Installer 17.1, released on May 27th, 2020.

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

Return to “Common Problems”