Skip to content

Instantly share code, notes, and snippets.

@mrik23
Created January 30, 2018 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrik23/fcfc8ae3efef3d701dc87a63bbcbfbda to your computer and use it in GitHub Desktop.
Save mrik23/fcfc8ae3efef3d701dc87a63bbcbfbda to your computer and use it in GitHub Desktop.
PowerShell one-liner script to remove email access for one user (disable POP IMAP MAPI OWA ActiveSync and Outlook app for iOS and Android). Tested on Exchange Online.
Set-CASMailbox -Identity someone@contoso.com -PopEnabled $False -ImapEnabled $False -MAPIEnabled $False -OWAEnabled $False -ActiveSyncEnabled $False -OWAforDevicesEnabled $false -EWSEnabled $False -EwsBlockList @{Add="Outlook-iOS/*","Outlook-Android/*"}
### Re-enable all protocols ###
#Set-CASMailbox -Identity someone@contoso.com -PopEnabled $true -ImapEnabled $true -MAPIEnabled $true -OWAEnabled $true -ActiveSyncEnabled $true -OWAforDevicesEnabled $true -EWSEnabled $true -EwsBlockList @{Remove="Outlook-iOS/*","Outlook-Android/*"} -EwsApplicationAccessPolicy $null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment