Built
into the Exchange Server 2010 are a number of PowerShell cmdlets to
test the Client Access server and Hub Transport server roles. These
enable an administrator to easily verify settings, certificates, and
port access for the services. This can save an immense amount of
troubleshooting time or having to set up a test infrastructure.
These cmdlets are used by
the System Center Operations Manager 2007 R2 Exchange Server 2010
management pack to perform synthetic transactions. These provide the
OpsMgr infrastructure with data for monitoring thresholds and producing
performance reports.
There are cmdlets that specifically test the CAS functions and cmdlets that specifically test the Hub Transport functions.
The CAS test cmdlets are listed here:
Test-OutlookWebServices— Tests Autodiscover Settings.
Test-WebServicesConnectivity— Tests Exchange Web Services (EWS) functionality.
Test-ActiveSyncConnectivity— Tests ActiveSync functionality.
Test-OwaConnectivity— Tests Outlook Web App (OWA) functionality.
Test-ImapConnectivity— Tests the IMAP4 functionality for a user or all mailboxes.
Test-PopConnectivity— Tests the POP3 functionality for a user or all mailboxes.
Test-EcpConnectivity— Tests that the Exchange Control Panel (ECP) is accessible.
Test-PowerShellConnectivity— Tests PowerShell remote shell connectivity from a URI or a NetBIOS name.
The Hub Transport test cmdlets are listed here:
Test-Mailflow— Tests if mail can be sent from the system mailbox to another mailbox server and to external addresses.
Test-Message— Tests the transport rules for a test message and emails a report to the designated mailbox.
Test-EdgeSynchronization– Tests the Edge synchronization status for a subscription and for a specific user.
The following sections give examples of the more useful HUB/CAS test cmdlets.
The Test-OutlookWebServices Cmdlet
The Test-OutlookWebServices
cmdlet verifies the Autodiscover service settings for Outlook on an
Exchange server that has the Client Access server role installed. The Test-OutlookWebServices cmdlet uses a specified email address to verify that the Outlook provider is configured correctly.
An example of the Test-OutlookWebServices cmdlet is shown in Listing 1.
Listing 1. Test-OutlookWebServices Example
[PS] C:\>Test- OutlookWebServices –Identity:chrisa@companyabc.com RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1003 Type : Information Message : Autodiscover is about to be tested with the e- mail address chrisa@companyabc.com.
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1006 Type : Information Message : Contacted the Autodiscover service at https:// EX1.companyabc.com/Autodiscover/Autodiscover.x ml.
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1016 Type : Success Message : [EXCH]-Successfully contacted the AS service a t https://ex1.companyabc.com/EWS/Exchange.asmx . The elapsed time was 109 milliseconds.
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1015 Type : Success Message : [EXCH]-Successfully contacted the OAB service at https://ex1.companyabc.com/EWS/Exchange.asm x. The elapsed time was 0 milliseconds.
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1014 Type : Success Message : [EXCH]-Successfully contacted the UM service a t https://ex1.companyabc.com/EWS/UM2007Legacy.asm x. The elapsed time was 31 milliseconds. RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 Id : 1006 Type : Success Message : Autodiscover was tested successfully.
|
As can be seen from the output, all the tests completed successfully.
The Test-OwaConnectivity Cmdlet
The Test-OwaConnectivity
cmdlet can be used to test Outlook Web App connectivity for all
Microsoft Exchange Server 2010 virtual directories on a specified client
access server for all mailboxes on servers running Exchange Server that
are in the same Active Directory site. The Test-OwaConnectivity cmdlet can also be used to test the connectivity for an individual Exchange Outlook Web App URL.
An example of the Test-OwaConnectivity cmdlet used to test access to an OWA URL (https://ex1.companyabc.com) using the user companyabc\chrisa credentials is shown in Listing 2.
Listing 2. Test-OwaConnectivity Example
[PS] C:\>Test-OwaConnectivity –URL:https://ex1.companyabc.co m/owa –MailboxCredential:(get-credential companyabc\chrisa) –TrustAnySSLCertificate | fl
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464 151c696 AuthenticationMethod : FBA MailboxServer : LocalSite : Default-First-Site-Name SecureAccess : True VirtualDirectoryName : Url : https://ex1.companyabc.com/ow a/ UrlType : Unknown Port : 0 ConnectionType : Plaintext ClientAccessServerShortName : LocalSiteShortName : Default-First-Site-Name ClientAccessServer : Scenario : Logon ScenarioDescription : Log on to Live and verify the response page. PerformanceCounterName : Logon Latency Result : Success Error : UserName : chrisa StartTime : 7/28/2009 8:10:27 PM Latency : 00:00:00.3750144 EventType : Success LatencyInMillisecondsString : 375.01 Identity : IsValid : True
|
The command will prompt for the password of the user chrisa during the run of the command. Note that the –TrustAnySSLCertificate parameter was used to bypass certificate checks.
The Test-ActiveSyncConnectivity Cmdlet
The Test-ActiveSyncConnectivity
cmdlet performs a full synchronization between a mobile device and a
specified mailbox to test the functionality of Exchange ActiveSync. If
the synchronization fails, a message is displayed in the Exchange
Management Shell.
The example shown in Listing 3 shows the Test-ActiveSyncConnectivity cmdlet used to test ActiveSync for the user chrisa.
Listing 3. Test-ActiveSyncConnectivity Example
[PS] C:\>Test-ActiveSyncConnectivity -MailboxCredential (get-credential companyabc\chrisa) -TrustAnySSLCertificate
WARNING: column "Error" does not fit into the display and w as removed.
CasServer LocalSite Scenario Result Latency(MS) --------- --------- -------- ------ ---------- ex1 Default-Fi... Options Success 15.63 ex1 Default-Fi... FolderSync Success 406.26 ex1 Default-Fi... First Sync Success 93.75 ex1 Default-Fi... GetItemEstimate Success 78.13 ex1 Default-Fi... Sync Data Success 156.26 ex1 Default-Fi... Ping Success 1515.75 ex1 Default-Fi... Sync Test Item Success 1375.02
|
During the run of the command, the get-credential cmdlet inline in the Test-ActiveSyncConnectivity command prompts for the credentials of the test user. The results of the seven tests were “success.”
The Test-Mailflow Cmdlet
The Test-Mailflow
cmdlet tests mail submission, transport, and delivery for Hub Transport
role servers. The cmdlet verifies that each mailbox server can
successfully send itself a message. You can also use this cmdlet to
verify that the system mailbox on one mailbox server can successfully
send a message to the system mailbox on another mailbox server.
The Test-Mailflow cmdlet example in Listing 4 shows testing mailflow between the mailbox server EX1 to the mailbox server EX2.
Listing 4. Test-Mailflow Example
[PS] C:\>Test-Mailflow ex1 –TargetMailboxServer ex2 RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464151c696 TestMailflowResult : Success MessageLatencyTime : 00:00:02.8297541 IsRemoteTest : True Identity : IsValid : True
|
The TestMailflowResult: Success shows that the mail flow was successful.
The Test-EdgeSynchronization Cmdlet
The Test-EdgeSynchronization
is a diagnostic cmdlet that provides a report of the synchronization
status of subscribed Edge Transport servers. You can use the
VerifyRecipient parameter with this cmdlet to verify that a single
recipient has been synchronized to the Active Directory Lightweight
Directory Services (AD LDS) directory service. This task provides useful
information to the administrator when it is run manually.
The command must be run on a
Hub Transport role server that is within the Active Directory site that
the Edge Transport server is subscribed to. Listing 5 shows the results of testing the synchronization status of edge synchronization.
Listing 5. Test-EdgeSynchronization Example
[PS] C:\>Test-EdgeSynchronization -MaxReportSize 500 -MonitoringContext $true
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464 151c696 UtcNow : 7/29/2009 4:45:32 AM Name : EX3 LeaseHolder : CN=EX1,CN=Servers,CN=Exchange Administrative Group (FYDIBO HF23SPDLT),CN=Administrative Groups,CN=CompanyABC,CN=Micro soft Exchange,CN=Services,CN= Configuration,DC=companyabc,D C=com LeaseType : Option ConnectionResult : Succeeded FailureDetail : LeaseExpiryUtc : 7/29/2009 5:43:49 AM LastSynchronizedUtc : 7/29/2009 4:43:49 AM CredentialStatus : Synchronized TransportServerStatus : Synchronized TransportConfigStatus : Synchronized AcceptedDomainStatus : Synchronized RemoteDomainStatus : Synchronized SendConnectorStatus : Synchronized MessageClassificationStatus : Synchronized RecipientStatus : Synchronized CredentialRecords : Number of credentials 3 CookieRecords : Number of cookies 2 **** TRUNCATED ****
|
The truncated results of the Test-EdgeSynchronization -MaxReportSize 500 -MonitoringContext $true command shows that all components are synchronized.
The cmdlet can also be used to test the synchronization status for an individual user. The Listing 6 shows the results of an example test.
Listing 6. Test-EdgeSynchronization User Example
[PS] C:\> Test-EdgeSynchronization -VerifyRecipient chrisa@companyabc.com
RunspaceId : 79f1e2b4-2db8-44c6-aa11-87464 151c696 UtcNow : 7/29/2009 4:54:50 AM Name : EX3 LeaseHolder : CN=EX1,CN=Servers,CN=Exchange Administrative Group (FYDIBO HF23SPDLT),CN=Administrative Groups,CN=CompanyABC,CN=Micro soft Exchange,CN=Services,CN= Configuration,DC=companyabc,D C=com LeaseType : Option ConnectionResult : Succeeded FailureDetail : LeaseExpiryUtc : 7/29/2009 5:52:51 AM LastSynchronizedUtc : 7/29/2009 4:52:51 AM CredentialStatus : Skipped TransportServerStatus : Skipped TransportConfigStatus : Skipped AcceptedDomainStatus : Skipped RemoteDomainStatus : Skipped SendConnectorStatus : Skipped MessageClassificationStatus : Skipped RecipientStatus : Synchronized CredentialRecords : Number of credentials 3 CookieRecords : Number of cookies 2
|
The results show that the RecipientStatus is synchronized for the user chrisa@companyabc.com.