Test Exchange Connectivity using Exchange Powershell on LAN
Microsoft provides a very useful tool to test MS Exchange Connectivity for Outlook / ActiveSync from the Internet. The same tests can be performed using Microsoft Exchange Powershell as well.
The below command can be used to Test Exchange Web services. After executing the command it will prompt the Credential where we have to provide the account credential.
test-webservicesconnectivity -MailboxCredential $(get-credential) -TrustAnySSLCertificate | FL
To use the command Test Mailbox should be enable in the Exchange Environment else you will get error "Failed to find the mailbox"
[PS] C:\>Test-OutlookWebServices -TargetAddress emailuser@domain1.com | fl WARNING: An unexpected error has occurred and a Watson dump is being generated: Failed to find the mailbox. Mailbox = 'extest_0218acace9d94@domain.local'. Failed to find the mailbox. Mailbox = 'extest_0218acace9d94@domain.local'. + CategoryInfo : NotSpecified: (:) [Test-OutlookWebServices], MailboxNotFoundException + FullyQualifiedErrorId : Microsoft.Exchange.Monitoring.MailboxNotFoundException,Microsoft.Exchange.Management.SystemConfigurationTasks.TestOutlookWebServicesTask
The Test mailbox creation can be avoid by providing the -identity switch. It will define against which mailbox the Test will be performed and will not look for the TEST Mailbox "extest_0218acace9d94@domain.local" to complete the command. e.g
Test-OutlookWebServices -Identity:SMTP ADDRESS -MailboxCredential (Get-Credential)
-TrustAnySSLCertificate switch can be used to avoid SSL Certificate error as most of the time internal Server names are not part of SSL SAN.
test-webservicesconnectivity -Identity:SMTP ADDRESS -MailboxCredential $(get-credential) -TrustAnySSLCertificate | FL
-AutoDiscoverServer switch is very useful when the Autodiscover is not working and we need to verify either the Autodiscover have some issue so we can point directly to the server using the switch.
test-webservicesconnectivity -Identity:SMTP ADDRESS -MailboxCredential $(get-credential) -TrustAnySSLCertificate -AutoDiscoverServer EXCHANGE SERVER | fl
The Results for the Test will be like below if everything is working fine.