skylerwhite
Posts: 1
Joined: Wed Aug 27, 2025 5:59 am

PowerShell Custom Action Fails at Install Time in MSI Project

Hello, I’m Skyler, new to Advanced Installer (about 2 months of use), and I’ve run into what seems to be a code-related bug. I added a custom action that runs a simple PowerShell script in my MSI project, but while the project builds successfully, the script fails during installation with the error “The system cannot execute the specified program.”
Here is the code I used:

Code: Select all

Write-Output "Custom action test started"
$path = "C:\TestFolder"
if (!(Test-Path $path)) {
    New-Item -ItemType Directory -Path $path
}
Write-Output "Custom action test finished"
When I run this script outside the installer, it works fine and creates the folder as expected. However, when packaged in Advanced Installer as a custom action, it fails consistently at install time. I expected the custom action to execute normally, but instead it stops the installation. Could this be a bug in how Advanced Installer handles embedded PowerShell code?
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: PowerShell Custom Action Fails at Install Time in MSI Project

Hello and welcome to our forums,

The script seems to be correct.

How do you execute it in Advanced Installer - could you please share some screenshots of how the custom action is scheduled?

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

Return to “Common Problems”