Powershell to disable Active Sync

bizzie247 used Ask the Experts™
Is there a Powershell command to disable ALL users from 365 Active Sync. We are using Microsoft Azure and 365. Users are assigned devises such as phones and tablets and  for those using  their own devises, we want more control over who is permitted to connect. To accomplish this, we want to first turn off Active Sync, then allow only after the user (500 plus), signs our access request forms. Looking for a quick way to disable all users from Active Sync and then manually or batch allow users after they have completed the form. Thanks
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Server engineer
To disable ActiveSync for users by using Exchange Online PowerShell, follow these steps:

Connect to Exchange Online by using remote PowerShell. For more information about how to do this, go to the following Microsoft website:
Connect to Exchange Online using remote PowerShell

Do one of the following:
To disable ActiveSync connectivity for a single user, run the following command:

Set-CASMailbox -Identity <Mailbox ID> -ActiveSyncEnabled $False

To disable ActiveSync connectivity for a group of users, use the Get-User cmdlet to change the scope of the command.

For example, to disable ActiveSync for all the users in the Sales department, run the following command:

Get-User -RecipientTypeDetailsUserMailbox | where {$_.Department -eq "Sales"} | Set-CASMailbox -ActiveSyncEnabled $False
Saif ShaikhServer engineer
To disable ActiveSync for all users in an organization, run the following command:

Get-Mailbox | Set-CasMailbox -ActiveSyncEnabled $False
Most Valuable Expert 2015
Distinguished Expert 2018


Thank you all!! Just what I needed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial