I had a special need to disable Outlook Anywhere for few mailboxes. Outlook profile created automatically with help from Auto Discover feature. It also enables Outlook Anywhere automatically. You may go into Outlook profile and disable the Proxy settings (Outlook Anywhere). Believe me, it will be enabled again when next time Outlook is started.
To disable Outlook Anywhere completely from server side, here are the Powershell cmdlets. These cmdlets should be run on Exchange Management Shell.
The following command will disable Outlook Anywhere for one Mailbox.
Get-Mailbox –Identity <UserName> | Set-CASMailbox -MAPIBlockOutlookRpcHttp:$True
If you have list of mailboxes that needs Outlook Anywhere to be disabled, you may use the following Powershell script. Type the mailbox names (username) on a text file by each username in a line. Save the text file as mailboxes.txt. Open the Exchange Management Shell and navigate to the location where the text file is saved.
Copy the contents of the script below and save it in a file as “DisableOA.ps1”. Run the script on the text file location as ./DisableOA.ps1. Or you can just type the script on the Exchange management shell itself.
$Mailboxes = Get-Content ./Mailboxes.txt
Foreach ($Mailbox in $Mailboxes)
Set-CASMailbox -Identity $Mailbox -MAPIBlockOutlookRpcHttp:$true –Verbose