MongoDB Atlas CLIを確認画面なしでインストール・アンインストールし、展開ツールで検出するためのコマンドです。マニフェストの記載か、インストーラー技術の既定値として確実なコマンドだけを表示しています。
関連ガイド: サイレントインストールのオプション一覧 · レジストリとPowerShellでアンインストールする方法
wingetを使う
PowerShell
winget install --id MongoDB.MongoDBAtlasCLI -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id MongoDB.MongoDBAtlasCLI -e --silentwinget uninstall --id MongoDB.MongoDBAtlasCLI -e --silentインストーラー別
64ビット · MSI · en-US
サイレントインストール
msiexec /i mongodb-atlas-cli_1.60.1_windows_x86_64.msi /qn /norestartログを出力
msiexec /i mongodb-atlas-cli_1.60.1_windows_x86_64.msi /qn /norestart /l*v "%TEMP%\mongodb-atlas-cli-install.log"アンインストール
msiexec /x {4DFEC3C9-C8B1-4997-93C9-1137D200E343} /qn /norestart- MSIプロダクトコード
- {4DFEC3C9-C8B1-4997-93C9-1137D200E343}
- アンインストール用レジストリキー
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{4DFEC3C9-C8B1-4997-93C9-1137D200E343}
PowerShell:ダウンロード・検証・インストール
公式ファイルをダウンロードし、SHA256を検証してからサイレントインストールします。
install-mongodb-atlas-cli.ps1
$url = 'https://fastdl.mongodb.org/mongocli/mongodb-atlas-cli_1.60.1_windows_x86_64.msi'
$sha256 = '279F642AE21396AF189C4F0F94E99DA8D9E42E1FE3A3B2848A6E1B64F91F3E82'
$file = Join-Path $env:TEMP 'mongodb-atlas-cli_1.60.1_windows_x86_64.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