Tuesday, June 28, 2011

Enable & Disable ActiveSync For Exchange 2007 and 2010 Users

Issue:  Your company asked Default behavior for new user mailbox creation , ActiveSync future to be disabled. You find out by default every MB user has ActiveSync future turned on. If you have some of your users wished to use ActiveSync while majority of the users are disabled the out the box Exchange configuration nor GUI will come into rescue but PowerShell.

See fallowing KB articles for disabling ActiveSync ,

This topic describes how to disable Microsoft Exchange ActiveSync. When you disable Exchange ActiveSync on a computer that is running Microsoft Exchange Server 2007 that has the Client Access server role installed, you disable the application pool that Exchange ActiveSync uses. An application pool is a group of processes that Internet Information Services (IIS) uses to perform a task.

To see ActiveSync Enabled users run fallowing PS (  Get is harmless, as the PS does not make any changes, you need to watch out for set function (-: )

Get-CASMailbox -resultSize unlimited -filter {activeSyncEnabled -eq $true}

image

Disable Active Sync for All Users

get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$False

 

image

Enable ActiveSync for All Users

get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$True

 

Now we will disable it for Everyone but for some selected users with fallowing Script

Get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$True | Get-content C:\ActiveSyncEnabledUsers.txt

 

image

On the C drive of my server I have created simple TXT file for the output

clip_image001

image

 last one

Get-Mailbox | ForEach {Get-ActiveSyncDeviceStatistics -Mailbox:$_.Identity} | ft DeviceFriendlyName, Devicetype, DeviceUserAgent

image

Respectfully,
Oz Casey, Dedeal

MCITP (EMA), MCITP (SA)
MCSE 2003, M+, S+, MCDST
Security+, Project +, Server +
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)

8 comments:

Anonymous said...

nice article.
nice job.

Veect said...

Does, this disable all activesync or all new accounts as well or will the ps need to be run daily?

Anonymous said...

I've tried running

get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$False

however, i have no success... seems like command only ran on a number of account. i've tried adding resultsize unlimited... still no success. pls advise

Unknown said...

I want to disable active sync for about 1000 mailboxes in exchange 2010..

We have all together 35000 mailboxes. Can u provide any scrip to disable active sync for those users. I have txt file in which 1000 mailbox alias are mentioned

godking said...

Get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$True | Get-content C:\ActiveSyncEnabledUsers.txt

is incorrect.

The correct syntax is
Get-content C:\temp\ActiveSyncDisabledUsers.txt | set-CASMailbox -ActiveSyncEnabled $True

or is you want to disable for users in a text file

Get-content C:\temp\ActiveSyncDisabledUsers.txt | set-CASMailbox -ActiveSyncEnabled $False

godking said...

Get-Mailbox | set-CASMailbox -ActiveSyncEnabled:$True | Get-content C:\ActiveSyncEnabledUsers.txt

is incorrect.

The correct syntax is
Get-content C:\temp\ActiveSyncDisabledUsers.txt | set-CASMailbox -ActiveSyncEnabled $True

or is you want to disable for users in a text file

Get-content C:\temp\ActiveSyncDisabledUsers.txt | set-CASMailbox -ActiveSyncEnabled $False

Nelson said...

Make things more easier,

create a test DG
add the list of users that you would like to block activesync
now run this command
Get-DistributionGroupMember -Identity "group name" | set-CASMailbox -ActiveSyncEnabled $False

simple and no confussion

Anonymous said...

Nice information about doing it in shell.
This post explains how to do in exchange control panel in Exchange 2013/2016, worth to have a look,
http://www.sysprobs.com/how-to-disable-or-enable-activesync-particular-user-on-exchange-2013-2016