MongoDB Toolsを確認画面なしでインストール・アンインストールし、展開ツールで検出するためのコマンドです。マニフェストの記載か、インストーラー技術の既定値として確実なコマンドだけを表示しています。
関連ガイド: サイレントインストールのオプション一覧 · レジストリとPowerShellでアンインストールする方法
wingetを使う
PowerShell
winget install --id MongoDB.DatabaseTools -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id MongoDB.DatabaseTools -e --silentwinget uninstall --id MongoDB.DatabaseTools -e --silentインストーラー別
64ビット · MSI · すべてのユーザー
サイレントインストール
msiexec /i mongodb-database-tools-windows-x86_64-100.20.1.msi /qn /norestartログを出力
msiexec /i mongodb-database-tools-windows-x86_64-100.20.1.msi /qn /norestart /l*v "%TEMP%\mongodb-tools-install.log"アンインストール
msiexec /x {0208A4FE-D4C5-4303-8716-5C3CACC94E93} /qn /norestart- MSIプロダクトコード
- {0208A4FE-D4C5-4303-8716-5C3CACC94E93}
- アンインストール用レジストリキー
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0208A4FE-D4C5-4303-8716-5C3CACC94E93}
- UpgradeCode
- {EFFC2F80-8F82-413F-A3BA-4A96F3D2883A}
- インストール先フォルダー
- %ProgramFiles%\MongoDB\Tools\100
PowerShell:ダウンロード・検証・インストール
公式ファイルをダウンロードし、SHA256を検証してからサイレントインストールします。
install-mongodb-tools.ps1
$url = 'https://fastdl.mongodb.org/tools/db/mongodb-database-tools-windows-x86_64-100.20.1.msi'
$sha256 = '25A1ED6C860D876F0E14A507FF885D4DA7F3CD47AC2CC97E2212C4A576FDC09A'
$file = Join-Path $env:TEMP 'mongodb-database-tools-windows-x86_64-100.20.1.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