# Silent Install error 1 "Incorrect function"

**URL:** <https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373>\
**Category:** Pritunl VPN\
**Tags:** pritunl-client\
**Created:** [September 7, 2022, 2:02pm UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373 "2022-09-07T14:02:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wildcatze](https://forum.pritunl.com/user_avatar/forum.pritunl.com/wildcatze/32/141_2.png) [@Wildcatze](https://forum.pritunl.com/u/Wildcatze)\
**Post date:** [September 7, 2022, 2:02pm UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373/1 "2022-09-07T14:02:30Z")

</div>

Hello team, could you please help me with this small issue? 😄  
I am automating the silent installation of Pritunl via PowerShell. I have used [this article](https://docs.pritunl.com/docs/silent-automated-install). 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:

```auto
$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.

 ![Pritunl err#1](https://forum-static.pritunl.com/original/1X/7eca2e17bb1e8bfd642f630a3de1d760c4e97ba2.png)

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [September 8, 2022, 10:45am UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373/2 "2022-09-08T10:45:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wildcatze](https://forum.pritunl.com/user_avatar/forum.pritunl.com/wildcatze/32/141_2.png) [@Wildcatze](https://forum.pritunl.com/u/Wildcatze)\
**Post date:** [September 8, 2022, 11:06am UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373/3 "2022-09-08T11:06:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [September 8, 2022, 11:23am UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373/4 "2022-09-08T11:23:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wildcatze](https://forum.pritunl.com/user_avatar/forum.pritunl.com/wildcatze/32/141_2.png) [@Wildcatze](https://forum.pritunl.com/u/Wildcatze)\
**Post date:** [September 8, 2022, 11:25am UTC](https://forum.pritunl.com/t/silent-install-error-1-incorrect-function/373/5 "2022-09-08T11:25:35Z")

</div>

Thanks mate, this post can be closed then. 😀
