Silent Install error 1 "Incorrect function"

Hello team, could you please help me with this small issue? :smile:
I am automating the silent installation of Pritunl via PowerShell. I have used this article. When using the install attributes: ‘/VERYSILENT EULA_ACCEPT=YES’ or ‘/VERYSILENT’ or ‘/VERYSILENT /SUPPRESSMSGBOXES’ or ‘/QUIET /VERYSILENT’ the installation returns with the error code 1 and description “incorrect function”.
Where seems to be the issue?
The way I am getting the error code is by this ps script ran as admin:

$URL = 'https://github.com/pritunl/pritunl-client-electron/releases/download/1.3.3281.66/Pritunl.exe'; <#Insert download URL#>
$File = "Pritunl.exe";     <#Insert the name of downloaded file#>
$Folder = "Pritunl";           <#Insert folder name to contain the downloaded file#>
$FolderPath = "$env:TEMP\$Folder";  <#Insert root folder path for the above folder followerd by \$Folder#>
$FilePath = "$FolderPath\$File";    <#File path for the downloaded file#>
$InstallArguments = '/VERYSILENT EULA_ACCEPT=YES'; <#Insert install arguments#>
function CleanWorkDirectory {
    if <#f1.0#>(Test-Path -Path $FolderPath)<#Directory found#>
    {
        Write-Host "Cleaning download directory $Folder, please wait ...";
        Remove-Item -Path $FolderPath -Recurse -Force -Confirm:$false;
        Start-Sleep -Milliseconds 50;
        if <#f1.1#>(Test-Path -Path $FolderPath)
        {
            Write-Host "Directory $FolderPath could not be removed by the script.`nPlease try removing it manually.`nThe folder is located in $FolderPath.";
        }
        else <#f1.1#><#File deleted successfully#>
        {
            Write-Host "The directory $Folder was removed from the system.";
        }
    }
    else <#f1.0#><#Directory not found#>
    {
        Write-Host "Directory `"$FolderPath`" was either not found or deleted in other methods.`nProceeding to the next step `(if any`).";
    }  
}
New-Item -Path $env:TEMP -Name $Folder -ItemType "directory" -Force | Out-Null;
Write-Host "Created download directory with the path $FolderPath.`nDownloading $File, please wait ...";
$Download = New-Object System.Net.WebClient;
$Download.DownloadFile("$URL","$FilePath");
if <#1#>(Test-Path -Path $FilePath -PathType Leaf) <#Download is successful#>
{
Write-Host "File $File finished downloading, proceeding to installation.";
    $Install = Start-Process -FilePath $FilePath -ArgumentList $InstallArguments -PassThru -Wait;
    if <#2#>($Install.ExitCode -eq 0) <#Installation is successful#>
    {
        Write-Host "Exit code received $($Install.ExitCode), Installation was succesful." -ForegroundColor Yellow -BackgroundColor DarkGray;
        Start-Sleep -Seconds 1;  
        CleanWorkDirectory;  
    }
    else <#2#><#Installation failed#>
    {
        Write-Host "Installation of $File failed. Error described is:";
        Write-Host $Install.ExitCode -ForegroundColor Yellow -BackgroundColor DarkGray;
        net helpmsg $Install.ExitCode;
        CleanWorkDirectory;
    }
}
else <#1#><#Download failed#>
{
    Write-Host "The files $File did not download, process will terminate without installation.`nDeleting work directory $FolderPath.";
    Remove-Item -Path $FolderPath -Recurse -Force -Confirm:$false;
}
Start-Sleep -Milliseconds 50;

Normally I believe that only 0 is considered success, while every other return code than 0 means it returned an error. Although, despite the error “Incorrect Function”, the application does get installed, but only sometimes.
Tried using win10 and win11 physical and vm environments.

I was able to reproduce the exit code but there doesn’t appear to be any issue with the installation. If you have an install that doesn’t work add /LOG="install.log" to the install arguments to get the error message.

Hey Zach, so does it mean that the exit code 1 is a healthy response? Because if so then I can just adjust my syntax for this script.

I can’t find any documentation with Inno Setup that indicates it is the correct exit code but it appears to always exit with 1 when the installation is successful. It’s possible it will still exit with the same code when there is an error but both 0 and 1 should be assumed to be successful.

Thanks mate, this post can be closed then. :grinning: