This document describes the preparation of a local Microsoft Exchange Server environment for EWS-based integrations. The setup uses Active Directory Domain Services and a locally hosted Exchange Server instance running inside a Windows Server.
Step 1. Install Exchange Server
Download Exchange Server:
Microsoft Exchange Server Download
Open PowerShell as Administrator and run the following commands one by one:
Prepare Schema
.\Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
Prepare Active Directory
.\Setup.exe /PrepareAD /OrganizationName:"LabOrg" /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
Prepare All Domains
.\Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
Install Exchange
.\Setup.exe /Mode:Install /Roles:Mailbox /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF
The installation typically takes 30–60 minutes.
Restart the server after installation completes.
Step 2. Verify Exchange Installation
Check Exchange services: Get-Service *Exchange*
Most Exchange services should be in the Running state, including services related to Active Directory topology, transport, information store, frontend transport, search, and RPC client access.
Some services such as POP3 or IMAP4 may remain stopped if they are not configured or required.
Verify EWS
Open: https://localhost/EWS/Exchange.asmx
This confirms that Exchange Web Services (EWS) is available.
Verify Exchange Admin Center
Open: https://localhost/ecp
Open:https://localhost/owa
Step 3. Create a Shared Mailbox
Open Exchange Management Shell and create the shared mailbox:
New-Mailbox -Shared -Name "TestShared" -Alias TestShared
Grant Full Access permissions:
Add-MailboxPermission -Identity TestShared -User Administrator -AccessRights FullAccess
Grant Send As permissions:
Add-ADPermission TestShared -User Administrator -ExtendedRights "Send As"
Exchange Web Services (EWS) is a SOAP-based API used for integrations with Microsoft Exchange Server on-premises environments.
Typical EWS endpoint:https://localhost/EWS/Exchange.asmx
EWS can be used for:
- Reading and sending emails
- Shared mailbox access
- Calendar management
- Attachment handling
- Mailbox impersonation
- NTLM and Basic authentication
- Service integrations
Applications written in Node.js, C#, Python, or PowerShell can communicate with Exchange through this endpoint.
Step 5. Prepare Certificates for Node.js Integration
Export Exchange Certificate
Open Exchange Management Shell and list certificates:
Get-ExchangeCertificate | fl Thumbprint,Subject,CertificateDomains,Services
Create export directory:
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null
Export the certificate (Windows):
$thumb = "6ECFA8EDB06AD8EC06F180EBF2DFAA4FC23A245D"
$cert = Get-Item "Cert:\LocalMachine\My\$thumb"
[System.IO.File]::WriteAllBytes(
"C:\Temp\exch-srv.cer",
$cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert)
)
Copy the .cer file to the local machine.
Trust the Certificate
Run on the local machine:
certutil -addstore -f Root "C:\certs\exch-srv.cer"