Commands for installing AWS SAM Command Line Interface without prompts, removing it again and detecting it from deployment tools. A command is shown only when it is certain: from the manifest or the installer technology’s documented default.
Related guide: Silent install switches: MSI, NSIS, Inno Setup · Uninstall a program with the registry or PowerShell
With winget
PowerShell
winget install --id Amazon.SAM-CLI -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Amazon.SAM-CLI -e --silentwinget uninstall --id Amazon.SAM-CLI -e --silentBy installer
64-bit · MSI · All users
Silent install
msiexec /i AWS_SAM_CLI_64_PY3.msi /qn /norestartWrite a log
msiexec /i AWS_SAM_CLI_64_PY3.msi /qn /norestart /l*v "%TEMP%\aws-sam-command-line-interface-install.log"Uninstall
msiexec /x {C009020D-5810-4BB7-B843-013ED33BB5EF} /qn /norestart- MSI product code
- {C009020D-5810-4BB7-B843-013ED33BB5EF}
- Uninstall registry key
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C009020D-5810-4BB7-B843-013ED33BB5EF}
- UpgradeCode
- {869D7B3B-A7C9-4E19-AC94-190305391ED1}
- Install folder
- %ProgramFiles%/Amazon/AWSSAMCLI
PowerShell: download, verify, install
Downloads the official file, checks its SHA256 and installs it silently.
install-aws-sam-command-line-interface.ps1
$url = 'https://github.com/aws/aws-sam-cli/releases/download/v1.170.0/AWS_SAM_CLI_64_PY3.msi'
$sha256 = 'C7C4E930CCBC17194C3B9E36E506A846ACFE0856F0CCC2561BD6E693BFEB4E4E'
$file = Join-Path $env:TEMP 'AWS_SAM_CLI_64_PY3.msi'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process msiexec.exe -ArgumentList '/i', ('"{0}"' -f $file), '/qn', '/norestart' -Wait