Problem solve Get help with specific problems with your technologies, process and projects.

Managing Exchange 2010 SP1 ActiveSync from the command line

The number of mobile users grows by the day, so it helps to understand how to manage ActiveSync from the command line. Here are the four most important EMS commands in Exchange 2010 SP1.

Microsoft’s recent disclosure that PowerShell will play a larger role in server management gives Exchange administrators another reason to familiarize themselves with the command line. Consider the growing number of mobile and remote users and you’ll see why it helps to master the commands necessary to manage ActiveSync.

The Exchange Management Shell commands discussed here are intended for use with Exchange 2010 SP1. Many of these commands exist in earlier versions of Exchange, but in certain cases, Microsoft has changed the syntax.

Creating a new ActiveSync mailbox policy via the Exchange Management Shell
Creating new ActiveSync mailbox policies from the command line may seem pointless to some. After all, many administrators create a single ActiveSync mailbox policy and it’s all they need. However, it’s important to realize there are many different mobiles devices out there and they all have different capabilities.

You can achieve a more granular level of control if you create a separate ActiveSync mailbox policy for each device type, and then base each policy around an individual device’s capabilities. For example, you can create one policy for Windows phones and a separate policy for iPhones.

To create a new ActiveSync mailbox policy, use the New-ActiveSyncMailboxPolicy command and append the –Name parameter. You must also assign the new policy a descriptive name. Your command will look similar to this:

New-ActiveSyncMailboxPolicy –Name ‘<policy name>’

After you create an ActiveSync mailbox policy, you must assign policy values. There are a number of parameters you can append to this command depending on how you’d like to configure the policy. Here are some commonly used parameters:

AllowNonProvisionableDevices
DevicePasswordEnabled
AlphanumericDevicePasswordRequired
MaxInactivityTimeDeviceLock
PasswordRecoveryEnabled
RequireDeviceEncryption
AttachmentsEnabled
AllowSimpleDevicePassword

Assign either a $True or $False value to all of these parameters. Other parameters require numerical values, while the Unlimited and $Null values can take the place of numbers. Here are some examples:

MinDevicePasswordLength $Null
DevicePasswordExpiration ‘Unlimited’
DevicePasswordHistory ‘0’

Below, observe that I’ve created an ActiveSync mailbox policy with all the aforementioned parameters:

New-ActiveSyncMailboxPolicy –Name ‘<policy name>’ -AllowNonProvisionableDevices $False –DevicePasswordEnabled $False –AlphanumericDevicePasswordRequired $False –MaxInactivityTimeDeviceLock $False –PasswordRecoveryEnabled $False –RequireDeviceEncryption $True –AttachmentsEnabled $True –AllowSimpleDevicePassword $True -MinDevicePasswordLength $Null -DevicePasswordExpiration ‘unlimited’ -DevicePasswordHistory ‘0’

Adding a user to an ActiveSync mailbox policy via the Exchange Management Shell
Just as you can create an ActiveSync mailbox policy from the command line, you can also add users to the policy via an Exchange Management Shell (EMS) command:

Set-CASMailbox <user name> -ActiveSyncMailboxPolicy(Get-ActiveSyncMailboxPolicy “<policy name>”).Identity

For example, if you want to add a user named JaneD to an ActiveSync mailbox policy named WindowsPhone, you can use the following command:

Set-CASMailbox JaneD –ActiveSyncMailboxPolicy (Get-ActiveSyncMailboxPolicy “WindowsPhone”).Identity

Retrieve mobile device usage statistics via the Exchange Management Shell
You can use the Get-ActiveSyncDeviceStatistics command in two ways. For one, you can use it to retrieve ActiveSync usage statistics for an individual user. To do so, use the following command:

Get-ActiveSyncDeviceStatistics –Identity <user name>

You can also use this command to create a report detailing the end users in your organization that have devices linked to their Exchange mailboxes. You can then display usage statistics for those devices. This command’s syntax is tricky because you must apply a filter to prevent client access server-related statistics from displaying alongside the mobile device usage statistics. To do so, use the following command:

Get-CASMailbox –Filter {HasActiveSyncDevicePartnership –eq $true and –not DisplayName –Like “CAS_(*”} | Get-Mailbox | ForEach { Get-ActiveSyncDeviceStatistics –Mailbox $_}

View which mobile devices are in use via the Exchange Management Shell
To find out how many devices a user has, use the Get-ActiveSyncDevice command. The reasons to use this command are similar to those of the Get-ActiveSyncDeviceStatistics command. For example, to view the devices registered to an individual user, use the following command:

Get-ActiveSyncDevice –Identity <user name>

To view all devices for all users in your Exchange organization, use the following command:

Get-CASMailbox –Filter {HasActiveSyncDevicePartnership –eq $true and –not DisplayName –Like “CAS_(*”} | Get-Mailbox | ForEach { Get-ActiveSyncDevice –Mailbox $_}

ABOUT THE AUTHOR:
Brien Posey
is an eight-time Microsoft MVP with two decades of IT experience. Before becoming a freelance technical writer, Brien worked as a CIO for a national chain of hospitals and healthcare facilities. He has also served as a network administrator for some of the nation’s largest insurance companies and for the Department of Defense at Fort Knox.

This was last published in November 2011

Dig Deeper on Outlook management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchSQLServer

SearchEnterpriseDesktop

SearchVirtualDesktop

Close