Yes. Visual Studio supports fully silent installs, but the script must:
- Use the correct bootstrapper and command-line options.
- Check the actual exit code and logs to see why it fails.
From the documented behavior of the Visual Studio installer:
-
%ERRORLEVEL% = 0means 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
--waitso 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:
-
--waitensures 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--addand--channelURI). - If the exit code is
5007(requirements not met) or8010(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:
- Ensure
--quietis used for silent mode. - Keep
--waitso the script can read the exit code. - Inspect the Visual Studio installer logs in
%TEMP%to find the specific failure cause, using the documented error codes as a guide.
References: