Share via

Error installing Visual Studio 2026 Pro with a completely silent installation & chocolatey.

Carvalho Tiago Manuel 20 Reputation points
2026-06-16T10:53:20.0833333+00:00

Hello everyone,

I’m currently developing an application to standardize software installation at the company where I work.

I’m using Chocolatey and want to install Visual Studio 2026 via a completely silent installation—without any user interface—so that all add-ons, etc., are installed in the same way.

However, I’m not able to get this to work, and it seems to me that it’s because of the Visual Studio installer, but I’m not sure.

I have the Visual Studio bootstrapper on a server, and the goal is to fetch the file from there and then perform the installation, but halfway through I always get an exit code.

This is the current scrip i am using

try {
    Write-Host "==========================================================="
    Write-Host "Installing $env:ChocolateyPackageName"
    Write-Host "==========================================================="
    $ErrorActionPreference = 'Stop'
    $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
    Write-Host "Tools Directory: $toolsDir"

    # ---------------------------------------------------------
    # URL ZIP (layout offline)
    # ---------------------------------------------------------
    $url = 'myserver/vs2026_pro_offline.zip'
    $fileName       = Split-Path -Leaf $url
    $downloadedFile = Join-Path $toolsDir $fileName
    # Download
    Get-ChocolateyWebFile -PackageName $env:ChocolateyPackageName `
                          -FileFullPath $downloadedFile `
                          -Url $url
    # ---------------------------------------------------------
    # Extract ZIP
    # ---------------------------------------------------------
    $installerPath = $null
    $ext = [System.IO.Path]::GetExtension($downloadedFile).ToLower()
    if ($ext -eq '.zip') {
        $unzipDir = Join-Path (Split-Path -Parent $toolsDir) "unzipped"
        Get-ChocolateyUnzip -FileFullPath $downloadedFile -Destination $unzipDir
        Write-Host "Cleaning up downloaded files..."
        if (Test-Path $downloadedFile) {
            Remove-Item $downloadedFile -Force
            Write-Host "Deleted: $downloadedFile" -ForegroundColor Green
        }
		
        $targetName = 'vs_Professional.exe'
        $installerPath = Get-ChildItem -Path $unzipDir -Filter *.exe -File -Recurse |
            Where-Object { $_.Name -ieq $targetName } |
            Select-Object -First 1 -ExpandProperty FullName
        if (-not $installerPath) {
            throw "No vs_Professional.exe found inside ZIP."
        }
    } else {
        $installerPath = $downloadedFile
    }
    Write-Host "Installer: $installerPath"
    Write-Host "-------------------------------------------------------"
    Write-Host "Installing..."
    Write-Host "-------------------------------------------------------"

    # ---------------------------------------------------------
    # ChannelManifest 
    # ---------------------------------------------------------
    $channelURIPath = Join-Path $unzipDir "vs_professional_offline\ChannelManifest.json"
    Write-Host "channelURIPath: $channelURIPath"
    if (-not (Test-Path $channelURIPath)) {
        throw "ChannelManifest.json not found at: $channelURIPath"
    }
    $vsLog = Join-Path $toolsDir "vs_install.log"
    $installPath = "C:\Program Files\Microsoft Visual Studio\2026\Professional"
    $arguments = @(
      "--noweb"
      "--wait"
      "--add"
      "Microsoft.VisualStudio.Workload.ManagedDesktop"
      "--add"
      "Microsoft.VisualStudio.Workload.NetWeb"
        "--channelURI"
        $channelURIPath
    )
	
    Write-Host "Arguments: $($arguments -join ' ')"
    Write-Host "VS Log file: $vsLog"
    $process  = Start-Process -FilePath $installerPath -ArgumentList $arguments -PassThru -Wait
    $exitCode = $process.ExitCode
    if ($exitCode -ne 0) {
        Write-Host "Visual Studio install failed with exit code $exitCode"
        throw "Installer failed with exit code $exitCode"
    }
    else {
        Write-Host "Visual Studio installed successfully."
    }
}
catch {
    Write-Host "An error occurred: $_"
}
finally {
    if (![string]::IsNullOrWhiteSpace($unzipDir) -and (Test-Path $unzipDir)) {
        try {
           Remove-Item -Path $unzipDir -Recurse -Force
            Write-Host "Deleted extracted folder: $unzipDir" -ForegroundColor Green
        }
        catch {
            Write-Host "Failed to delete folder: $unzipDir" -ForegroundColor Red
        }
    }
}

If i use "--quit" "--norestart" i get exit code 1

Is there a way to install completely silently?

Thanks :D

Windows for business | Windows Client for IT Pros | Devices and deployment | Set up, install, or upgrade
0 comments No comments

Answer accepted by question author

AI answer

2026-06-16T10:53:51.11+00:00

Yes. Visual Studio supports fully silent installs, but the script must:

  1. Use the correct bootstrapper and command-line options.
  2. Check the actual exit code and logs to see why it fails.

From the documented behavior of the Visual Studio installer:

  • %ERRORLEVEL% = 0 means success.
  • Any non‑zero value (for example 1, 1603, etc.) is a failure and requires checking the logs.
  • Error codes like 740, 1618, 5005, 5007, etc., indicate specific problems (elevation, another install running, command-line parse error, requirements not met, etc.).

For a fully silent install:

  • Use the bootstrapper (for example vs_professional.exe) with command-line parameters.
  • Use --wait so the process exit code reflects the install result.
  • Use the documented error codes to interpret failures.

Example pattern (adapt to the existing script):

$arguments = @(
  "--noweb"          # use offline layout only
  "--wait"           # wait and return exit code
  "--quiet"          # fully silent
  "--norestart"      # do not restart automatically
  "--add"
  "Microsoft.VisualStudio.Workload.ManagedDesktop"
  "--add"
  "Microsoft.VisualStudio.Workload.NetWeb"
  "--channelURI"
  $channelURIPath
)

$process  = Start-Process -FilePath $installerPath -ArgumentList $arguments -PassThru -Wait
$exitCode = $process.ExitCode

if ($exitCode -ne 0) {
    Write-Host "Visual Studio install failed with exit code $exitCode"
    # Inspect logs in %TEMP%: dd_bootstrapper*.log, dd_client*.log, dd_setup*.log
}

Key points based on the documented behavior:

  • --wait ensures the process exit code is set to one of the documented values.
  • If the exit code is 1, -1, 1603, or any “Other” value, the documentation explicitly states that this means a failure condition and the logs in %TEMP% must be checked (dd_bootstrapper*, dd_client*, dd_setup*).
  • If the exit code is 5005 (command-line parse error), review the arguments (for example, ordering or quoting of --add and --channelURI).
  • If the exit code is 5007 (requirements not met) or 8010 (OS not supported), adjust the target machine or workloads accordingly.

So, a completely silent install is supported, but when --quit --norestart returns exit code 1, the next step is to:

  1. Ensure --quiet is used for silent mode.
  2. Keep --wait so the script can read the exit code.
  3. Inspect the Visual Studio installer logs in %TEMP% to find the specific failure cause, using the documented error codes as a guide.

References:

AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Harry Phan 22,230 Reputation points Independent Advisor
    2026-06-16T11:21:32.44+00:00

    The installer is failing because you’re using the wrong flag. Visual Studio doesn’t recognize --quit for silent installs; the correct option is --quiet. If you run the installer with --quiet --wait --norestart --noweb --channelURI <path> --add <workloads>, it will install silently without showing any windows. Make sure the offline layout you built has the right ChannelManifest.json, otherwise the installer will stop midway. If it still fails, check the log at %ProgramData%\Microsoft\VisualStudio\Setup\vs_installer.log,that file will tell you exactly which workload or dependency is missing.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.