Hello Emmanuel and welcome to our forums,
Yes, it is possible to add a custom action to your project through our PowerShell Automation support. This feature has been added in version 17.0 of Advanced Installer.
Most likely you did not find this because we do not currently have an article about it in our User Guide. I have created a ticket for our Technical Writing team to develop an article about this feature.
Please note, however, that not all custom actions are supported (i.e. you can not add all the Custom Action types).
Here is a sample PowerShell for what you need:
Code: Select all
$advinst = new-object -comObject "AdvancedInstaller"
$proj = $advinst.CreateProjectS("architect")
$file = $proj.FilesComponent.AddFileS("appdir", "C:\Users\Catalin\Desktop\sample.exe")
$ca = $proj.CustomActionsComponent.NewLaunchInstalledFile($file)
# Custom Action Options
$ca.CommandLine = "-cmd"
$ca.ExecuteSequenceCondition = "1"
$ca.ExecutionTime = "Deferred"
$ca.FailInstallationIfReturnsError = $true
$ca.RunUnderLocalSystemAccount = $true
$ca.WaitToFinish = $true
Hope this helps!
Best regards,
Catalin