Have a Question?
< All Topics

Provision Exchange 2019 with PowerShell

Tutorial on how to provision Exchange 2019 with PowerShell on Windows 2019 Server Core running on vSphere ESXi 6.7 Host with 2 x vCPU, 8GB RAM and 120GB HDD configured for Lab testing purpose

128GB RAM is recommended for Production Exchange 2019 Server

Prerequisites Components

  1. Install latest Update for Windows 2019 Server Core with PowerShell
  2. Download and install .NET 4.8 Framework

.NET 4.8 Framework can only be installed with /q (Silently) in Server Core

PS C:\Exchange2019> .\ndp48-x86-x64-allos-enu.exe /q
  1. Download and Install Visual C++ Redistributable Packages for Visual Studio 2013

The Visual C++ Redistributable package is required if you’re using the Exchange Setup Wizard to prepare Active Directory. If you’re using unattended Setup from the command line to prepare Active Directory, this package isn’t required

PS C:\> cd C:\Exchange2019\
PS C:\Exchange2019> .\vcredist_x64.exe	
  1. Install Server Media Foundation windows feature which is the required component for Unified Communications Managed API 4.0.
Install-WindowsFeature Server-Media-Foundation
  1. Mount the Exchange 2019 ISO installer to D:\ and install Unified Communications Managed API 4.0 from D:\UCMARedist
PS D:\UCMARedist> .\Setup.exe

Provision Exchange 2019 with PowerShell

  1. Install IIS Roles & Features required for Exchange 2019
Install-WindowsFeature Server-Media-Foundation, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-PowerShell, 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-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, RSAT-ADDS
  1. Restart Computer

Preparation of AD Schema & Domain

Provision Exchange 2019 with PowerShell

Install Exchange 2019 Server with the command below

D:\>Setup.exe /m:Install /Roles:MB /IAcceptExchangeServerLicenseTerms

Detail Installation log for reference

Microsoft Exchange Server 2019 Cumulative Update 6 Unattended Setup

Copying Files...
File copy complete. Setup will now collect additional information needed for installation.

Management tools
Mailbox role: Transport service
Mailbox role: Client Access service
Mailbox role: Mailbox service
Mailbox role: Front End Transport service
Mailbox role: Client Access Front End service

Performing Microsoft Exchange Server Prerequisite Check

    Configuring Prerequisites                                                                         COMPLETED
    Prerequisite Analysis                                                                             COMPLETED

Configuring Microsoft Exchange Server

    Preparing Setup                                                                                   COMPLETED
    Stopping Services                                                                                 COMPLETED
    Copying Exchange Files                                                                            COMPLETED
     anguage Files                                                                                    COMPLETED
    Restoring Services                                                                                COMPLETED
    Language Configuration                                                                            COMPLETED
    Exchange Management Tools                                                                         COMPLETED
    Mailbox role: Transport service                                                                   COMPLETED
    Mailbox role: Client Access service                                                               COMPLETED
    Mailbox role: Mailbox service                                                                     COMPLETED
    Mailbox role: Front End Transport service                                                         COMPLETED
    Mailbox role: Client Access Front End service                                                     COMPLETED
    Finalizing Setup                                                                                  COMPLETED

The Exchange Server setup operation completed successfully.
Setup has made changes to operating system settings that require a reboot to take effect. Please reboot this server
prior to placing it into production.

Reboot the Exchange 2019 Server

Remote PowerShell to Exchange 2019 Server

Login to Exchange 2019 Console to Enable Basic Authentication for PowerShell Virtual Directory

#Connect to Exchange 2019 locally
. 'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1'
Connect-ExchangeServer -auto

#Enable Basic Authentication for PowerShell Virtual Directory
Get-PowerShellVirtualDirectory | Set-PowerShellVirtualDirectory -BasicAuthentication $true

Connect to Exchange 2019 Server via PowerShell remotely from Windows Machines with PowerShell ISE installed

# Convert the password to secure string and save it to a file
"P@ssw0rd" | ConvertTo-SecureString -AsPlainText -Force | ConvertFrom-SecureString | Out-File "C:\scripts\Aventis.txt"

$UserName = "AVENTIS\administrator"
$Password = Get-Content C:\Scripts\Aventis.txt| ConvertTo-SecureString

#Specify Credential with password 
$Credential = new-object -typename System.Management.Automation.PSCredential -ArgumentList $UserName,$Password

#Required only if Self Sign SSL Certificate is used 
$SessionOption = New-PSSessionOption -SkipRevocationCheck -SkipCACheck -SkipCNCheck

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://mail.aventis.com.my/powershell `
-Credential $Credential -Authentication basic -AllowRedirection -SessionOption $SessionOption

Import-PSSession $Session

Post Configuration

Refer to Provision Exchange 2013 Server with PowerShell for the following tasks

  • Rename the local Database, and move it to other drives
  • Add a New Accepted Domain, Email Policy and SMTP Connector
  • Change the URL for OWA, ECP, OAB, EWS, ActiveSync, Autodiscover & PowerShell Virtual Directories
  • Generate Wildcard SSL Certificate from Let’s Encrypt and import it to Exchange 2019
#Import PFX 
$Password = "P@ssw0rd" | ConvertTo-SecureString -AsPlainText -Force
Import-PfxCertificate -FilePath C:\temp\AventisLabInfo.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $Password

#Replace the default self sign cert with Let's Encrypt wildcard SSL Cert
$Thumbprint = Get-ExchangeCertificate | ? Subject -like "*aventislab.info*"
Enable-ExchangeCertificate -Thumbprint $Thumbprint.Thumbprint -Services SMTP, IIS 
  • Enable Outlook Anywhere

Table of Contents
Scroll to Top