MongoDB 3.6.2 Windows离线安装指定特性失败报错求助
ADDLOCAL=Server on Offline Windows Servers I’ve dealt with this exact bug in MongoDB 3.6.x MSI installers before—let’s break down what’s going wrong and how to fix it:
Root Cause
The error happens because the MongoDB 3.6 MSI has a flawed custom action tied to Compass installation. When you specify a custom ADDLOCAL value (like Server instead of ALL), the installer still tries to run a PowerShell command for Compass setup—but since Compass isn’t included in your selected features, the command path is empty. This leads to the invalid PowerShell expression & '' ; exit $($Error.Count) that shows up in your log.
Solutions
1. Use the SKIP_COMPASS_INSTALL Parameter (Simplest Fix)
MongoDB 3.6+ MSIs support the SKIP_COMPASS_INSTALL=1 parameter to explicitly skip Compass installation. This bypasses the problematic custom action entirely while letting you install only the Server component.
Update your installation command to:
msiexec.exe /qn /i mongodb-win32-x86_64-2008plus-ssl-3.6.2-signed.msi INSTALLLOCATION="C:\Program Files\MongoDB\Server\3.6\" ADDLOCAL=Server SKIP_COMPASS_INSTALL=1 /l*v MongoDBInstall.log
2. Modify the MSI Package (If the Parameter Fails)
If the SKIP_COMPASS_INSTALL parameter doesn’t resolve the issue (rare for 3.6.2), you can edit the MSI to remove the faulty custom action using the Orca MSI Editor:
- Download and install Orca (part of the Windows SDK).
- Open your MongoDB MSI file in Orca.
- Navigate to the
CustomActiontable. - Find and delete the row named
InstallCompassScript. - Save the modified MSI (use "Save As" to avoid overwriting the original).
- Run your original installation command with the edited MSI.
3. Fallback: Install All Features and Clean Up Compass
If the above options aren’t feasible, install all features first, then manually remove Compass-related files:
msiexec.exe /qn /i mongodb-win32-x86_64-2008plus-ssl-3.6.2-signed.msi INSTALLLOCATION="C:\Program Files\MongoDB\Server\3.6\" ADDLOCAL=ALL /l*v MongoDBInstall.log
After installation completes:
- Delete the
C:\Program Files\MongoDB\Server\3.6\bin\MongoDBCompass*files and directories. - Remove any MongoDB Compass shortcuts from the Start Menu.
Verification
After installation, confirm:
- The MongoDB Server service is running (check
services.mscfor the "MongoDB" entry). - Only server-related files exist in your
INSTALLLOCATION(no Compass binaries).
内容的提问来源于stack exchange,提问作者Richard Fennell

