Set an Exchange Activesync Policy for all users in a specific Company

Here is a command you can use to set a specific exchange activesync policy for all users in a specific company. This assumes that you have already set the company name in the ‘Company’ user attribute. Substitute YOUR_COMPANY_NAME with the company name the you have specified in the ‘Company’ user attribute for the users you wish to apply the policy to, and substitute YOUR_ACTIVESYNC_POLICY with the name of the activesync policy that you wish to set for this selection of users.   

Get-User -filter {Company -eq “YOUR_COMPANY_NAME”} | Set-CASMailbox -ActiveSyncMailboxPolicy(Get-ActiveSyncMailboxPolicy “YOUR_ACTIVESYNC_POLICY”).Identity

You can verify that the policy has been applied to the correct users by running the following command:

Get-CASMailbox | where{$_.ActivesyncMailboxPolicy -Match “YOUR_ACTIVESYNC_POLICY”} | ft Displayname, ActivesyncMailboxPolicy, Servername

If you want to view the activesync policies that are applied to all the users in your organisation simply run the following command:

Get-CASMailbox | ft Displayname, ActivesyncMailboxPolicy, Servername


Get a users mobile device details using the Exchange Management Shell

Here is a quick command to get the details of a particular users mobile device or smartphone, including the device ID and the time it last synced, etc, using the Exchange Management Shell. When you type the command replace Username, with the name of the user that you wish to examine:

Get-ActiveSyncDeviceStatistics -Mailbox Username | Format-List

Display mobile device statistics using get-activesyncdevicestatistics