While the graphical Setup wizard is convenient for single-server lab evaluations, enterprise production deployments of Exchange Server Subscription Edition (SE) and Exchange Server 2019 require scripted, unattended command-line installations.
Command-line installations (Setup.exe /Mode:Install) prevent GUI timeout freezes, allow automated logging to remote management consoles, support automated infrastructure pipelines (PowerShell DSC, Ansible, Terraform), and enforce standardized disk partitioning and prerequisite checks.
This engineering runbook walks you through the entire command-line deployment lifecycle for modern Exchange Server: from Windows Server 2022 / 2025 prerequisite provisioning and Active Directory schema preparation to unattended execution and post-install health verification.
1. Operating System & Software Prerequisites
Before launching Setup.exe, run the following PowerShell commands from an elevated terminal on your target Windows Server 2022 / 2025 host:
Step 1: Install Required Windows Features
Install-WindowsFeature RSAT-ADDS, Server-Media-Foundation, NET-Framework-45-Features, `
RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, `
RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, `
WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, `
Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, `
Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, `
Web-ISAPI-Filter, Web-Metabase, Web-Net-Ext45, Web-Request-Monitor, `
Web-Static-Content, Web-Windows-Auth, Web-WMI -Restart:$false
Step 2: Download & Install Runtime Packages
- Visual C++ 2013 Redistributable Package (x64)
- Visual C++ 2015–2022 Redistributable Package (x64)
- IIS URL Rewrite Module 2.1 (x64)
- Unified Communications Managed API 4.0 Runtime (UCMA 4.0)
2. Active Directory Preparation via CLI
If this is the first Exchange Server SE / 2019 server in your Active Directory forest, prepare the directory schema and configuration partition from a server located in the same Active Directory site as the Schema Master:
:: 1. Extend the Active Directory Schema
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareSchema
:: 2. Prepare the Active Directory Organization
:: (Only specify /OrganizationName if this is a brand new Exchange deployment)
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /OrganizationName:"Contoso Corp"
:: 3. Prepare All Domains hosting users or Exchange resources
Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAllDomains
IMPORTANT:
Since Exchange 2019 CU12 and Exchange Server SE, Microsoft requires explicitly accepting telemetry diagnostics via either:
-/IAcceptExchangeServerLicenseTerms_DiagnosticDataON(Recommended)
-/IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
> Using the legacy/IAcceptExchangeServerLicenseTermsparameter alone will throw an error and abort setup.
3. Command-Line Installation Syntax
In modern Exchange (Exchange 2016, 2019, and Exchange SE), Microsoft consolidated the architectural roles into two options:
- Mailbox Role (
/roles:m): Combines Mailbox services, Client Access front-end, Hub Transport, and Unified Messaging routing. - Edge Transport Role (
/roles:e): Perimeter anti-spam and mail hygiene proxy.
Standard Unattended Mailbox Role Installation
Run this command from an elevated Command Prompt or PowerShell (mounted to the Exchange ISO drive, e.g., E:\):
Setup.exe /Mode:Install /Roles:Mailbox /TargetDir:"D:\Program Files\Microsoft\Exchange Server\V15" /InstallWindowsComponents /IAcceptExchangeServerLicenseTerms_DiagnosticDataON
Explanation of Parameters:
| Switch | Parameter Options | Description |
|---|---|---|
/Mode: or /m: | Install, Upgrade, Uninstall, RecoverServer | Specifies the operation. Use Install for fresh server builds and Upgrade for cumulative updates. |
/Roles: or /r: | Mailbox (or m), EdgeTransport (or e), ManagementTools (or mt) | In Exchange SE and 2019, ca, hub, and um switches are obsolete. Use m for all Mailbox services. |
/TargetDir: | Absolute path string | Specifies custom installation drive (e.g., fast dedicated SSD/NVMe volume). |
/InstallWindowsComponents | Switch | Automatically installs any missing Windows Server operating system roles or features. |
/IAcceptExchangeServerLicenseTerms_DiagnosticDataON | Switch | Accepts license terms and enables diagnostic telemetry reporting. |
4. Post-Installation Verification & Health Check
Once Setup finishes with The Microsoft Exchange Server setup operation completed successfully, reboot the server and run this post-installation PowerShell audit:
# 1. Verify Exchange Services
Get-Service | Where-Object { $_.Name -like "MSExchange*" -and $_.StartType -eq "Automatic" } |
Format-Table Name, Status, StartType -AutoSize
# 2. Check Server Component State
Get-ServerComponentState -Identity $env:COMPUTERNAME |
Format-Table Component, State, Requester -AutoSize
# 3. Test Core Exchange Health
Test-ServiceHealth
Test-SystemHealth
# 4. Verify Extended Protection (EPA) on Virtual Directories
$vdirs = @("Autodiscover", "EWS", "OWA", "ECP", "OAB", "Microsoft-Server-ActiveSync", "PowerShell", "RPC")
foreach ($vdir in $vdirs) {
$epa = Get-WebConfigurationProperty -PSPath "IIS:\Sites\Default Web Site\$vdir" `
-Filter "system.webServer/security/authentication/windowsAuthentication/extendedProtection" `
-Name "tokenChecking" -ErrorAction SilentlyContinue
[PSCustomObject]@{
VirtualDirectory = $vdir
ExtendedProtection = $epa.Value
}
}
5. Security Patching: Applying the Latest Security Update (SU)
A clean installation from the RTM ISO does not include the latest monthly security fixes. Never put a newly installed Exchange Server into production before applying the latest Security Update.
- Download the latest cumulative security update (e.g., KB5133453).
- Open an elevated command prompt (
Run as administrator). - Execute the MSP patch:
msiexec.exe /p Exchange2019-KB5133453-x64-en.msp /qn /l*v "C:\ExchangeSetupLogs\KB5133453_Install.log"
- Reboot the server and confirm all DAG replication endpoints, virtual directories, and transport queues are online.
💬 Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update