Scenario: You want to test whether ActiveSync (EAS) is working properly. You can use the following script to determine if EAS is failing on any of your Exchange Client Access Servers:
Script:
#Gather Credentials for the Test User into a variable $1 = get-credential ("DomainEASTestuser") #Gather Servers into a variable $Servers = Get-clientaccessserver #Define your collection variable $EAS = @() #Loop through each server and test $Servers | %{$EAS += Test-ActiveSyncConnectivity -AllowUnsecureAccess:$true -ClientAccessServer $_ -MailboxCredential $1 -lightmode}