Missing PowerShell Features with Two Installations - Advanced Installer Community
NovAtel
Posts: 13
Joined: Mon Mar 18, 2019 9:58 pm

Missing PowerShell Features with Two Installations

Hello,

I have 2 Advanced Installer versions installed (16.6.1 and 19.2).
I am trying to create a PowerShell script to edit the "MSIX/APPX Path" property in the "Install MSIX/Appx Package" custom action.
It looks like support for using this feature in PowerShell was first introduced in version 17.0 of Advanced Installer.

I have started a script:
$advinst = New-Object -ComObject AdvancedInstaller
$project = $advinst.LoadProject($aiProjectPath)
$project

OUTPUT:
FilesComponent : System.__ComObject
XmlFilesComponent : System.__ComObject
TempFilesComponent : System.__ComObject
IniFilesComponent : System.__ComObject
ShortcutsComponent : System.__ComObject
FoldersComponent : System.__ComObject
PredefinedFolders : System.__ComObject
ProductDetails : System.__ComObject
InstallParameters : System.__ComObject
RegistryComponent : System.__ComObject
DigitalSignature : System.__ComObject
PropertyComponent : System.__ComObject

It does not look like the script is recognizing the CustomActionsComponent mentioned in the example from this documentation
https://www.advancedinstaller.com/user- ... onent.html

Does PowerShell not register the new features (i.e. editing Custom Actions) in version 19.2 because of the side-by-side installations? Do I need to uninstall 16.6.1 in order for PowerShell to recognize the new features? Or is there a way to target the newest version within PowerShell?

Thanks.
NovAtel
Posts: 13
Joined: Mon Mar 18, 2019 9:58 pm

Re: Missing PowerShell Features with Two Installations

So the Project File I was working on was last built in 16.6.1 so I saved it with 19.2 and tried the PowerShell script again and now I get this error

$advinst = New-Object -ComObject AdvancedInstaller
$project = $advinst.LoadProject($aiProjectPath)


This project (fragment) was edited with a newer version of Advanced Installer (19.2) and cannot be loaded.

At line:2 char:1
+ $project = $advinst.LoadProject($aiProjectPath)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Liviu
Posts: 1420
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Missing PowerShell Features with Two Installations

Hello,

Usually, AI COM uses the latest version installed on the system. I'm not sure why it didn't in your case.

You need to register the latest AI version you want to use for COM, to do that, please follow these steps:

  1. Open an elevated Command Prompt.
    • Use the following command:

      Code: Select all

      "C:\Program Files (x86)\Caphyon\Advanced Installer 19.2\bin\x86\advinst.exe" /REGSERVER
      Use upper-case letters for "/REGSERVER".

      If you want to use another AI version, just use the above command. Go to the version you want to use and you can find the advinst.exe in "\bin\x86\".
      • Restart the PowerShell session and now you can build with the 19.2 version inside your script.
      Hope this helps! If you have any other questions, please don't hesitate to contact us.

      Best regards,
      Liviu
      ________________________________________
      Liviu Sandu - Advanced Installer Team
      Follow us: Twitter - Facebook - YouTube
      NovAtel
      Posts: 13
      Joined: Mon Mar 18, 2019 9:58 pm

      Re: Missing PowerShell Features with Two Installations

      Hi Liviu,

      I tried your solution and it only work after l restarted the machine.
      I also hadn't restarted the machine after installing 19.2 so maybe I didn't need to run the cmd at all and just needed to restart the server? 🤷‍♂️
      Either way, it seems to be working now.

      Thanks for the help
      Liviu
      Posts: 1420
      Joined: Tue Jul 13, 2021 11:29 am
      Contact: Website

      Re: Missing PowerShell Features with Two Installations

      You're welcome!

      I'm not sure why that happened, it should work without restarting the machine.

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

      Return to “Common Problems”