Skip to content

Commit 4d51f37

Browse files
committed
windows.ps1: handle winget Docker install failure (exit 4294967291)
winget install Docker.DockerDesktop fails with exit code 4294967291 when invoked as a non-admin user with UAC elevation. Two fixes: - Add --scope machine flag which avoids the elevation issue in most cases - Check $LASTEXITCODE after winget and show a clear error with guidance (re-run as admin, or download manually) instead of falsely claiming the install succeeded.
1 parent 07fbdb1 commit 4d51f37

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

deploy/windows.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,22 @@ function Invoke-CheckPrereqs {
206206
$install = Confirm-ML "Install Docker Desktop automatically via winget?" 'Y'
207207
if ($install -eq 'yes') {
208208
Step-ML "Installing Docker Desktop"
209-
winget install --id Docker.DockerDesktop --accept-source-agreements --accept-package-agreements
209+
# --scope machine avoids a known winget/UAC elevation issue (exit 4294967291)
210+
winget install --id Docker.DockerDesktop --scope machine `
211+
--accept-source-agreements --accept-package-agreements
212+
if ($LASTEXITCODE -ne 0) {
213+
Write-Host ""
214+
Err-ML "Docker Desktop installation failed (winget exit code $LASTEXITCODE)."
215+
Write-Host ""
216+
Warn-ML "This often happens when running as a non-admin user."
217+
Hint-ML "Try one of these:"
218+
Hint-ML " 1. Re-run this script from a PowerShell window opened as Administrator"
219+
Hint-ML " 2. Download and install Docker Desktop manually, then re-run:"
220+
Hint-ML " https://docs.docker.com/desktop/install/windows-install/"
221+
Exit-ML 1
222+
}
210223
Write-Host ""
211-
Warn-ML "Docker Desktop installed. Please:"
224+
Ok-ML "Docker Desktop installed. Please:"
212225
Hint-ML "1. Launch Docker Desktop from the Start Menu"
213226
Hint-ML "2. Complete the first-run setup wizard"
214227
Hint-ML "3. Wait for the whale icon in the system tray"

0 commit comments

Comments
 (0)