Exchange Online mailbox apps check via PowerShell

The estimated reading time 2 minutes

Some days ago I got a ticket where someone could not load his calendar in Microsoft Teams. Outlook worked fine the only thing was Out of Office Notification, also did not work. After some research I found the solution by activating EWS on this specific mailbox. One our later everything was fine.

You can find this mailbox apps or protocols inside the Exchange Online Admincenter and reactivate them easily.

Not that big issue so far, so I wondered whether there are much more people inside exchange organization. Of course I’m the lazy admin, so I don’t want to check hundrets of users in the web. Therefor I created a short PowerShell script to check all users if there is MAPI / EWS or ActiveSync disabled. Information is exported to CSV file so it is easy to filter with another tool like Excel or something else.

See the script to get this export.

#if there is no EXOnline connection already established use this cmdlet, otherwise ignore 
Connect-ExchangeOnline
##path output csv 
$output = "C:\temp\ews-check.csv"
#get all mailboxes smtp addresses
$mailaddresses = Get-Mailbox -ResultSize 5000 | Select-Object PrimarySMTPAddress -ExpandProperty PrimarySMTPAddress | Sort-Object PrimarySMTPAddress 
#generate csv file 
"EMAIL;MAPI;EWS;ACTIVESYNC" | Out-File -FilePath "$output" -Encoding utf8 -Append 
foreach($address in $mailaddresses){
   
    $disabledusers = Get-CASMailbox -Identity $address | Select-Object PrimarySMTPAddress,EwsEnabled,ActiveSyncEnabled,MAPIEnabled | Where-Object{($_.EwsEnabled -eq $false) -or ($_.ActiveSyncEnabled -eq $false) -or ($_.MAPIEnabled -eq $false) }

    if($disabledusers){
                $mapi = ($disabledusers).MAPIEnabled
                $ews = ($disabledusers).EwsEnabled
                $ActiveSync = ($disabledusers).ActiveSyncEnabled
            Write-Host "User $address has following services" -ForegroundColor Yellow
              "$address;$mapi;$ews;$ActiveSync"  | Out-File -FilePath "$output" -Encoding utf8 -Append  
            Write-Host "MAPI = $mapi, EWS = $ews, ActiveSync = $ActiveSync"
   }

}

If you want to enable EWS for one user via PowerShell you can use the following command.

Set-CASMailbox emailaddress -EwsEnabled $True

Hopefully the script help to avoid some clicking and searching around. If you liked this article please click on helpful and if you have any questions, let me know in the comment section.

Print Friendly, PDF & Email
Was this article helpful?
YesNo
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments