Below are a couple of commands we can use in Windows Powershell to run a report on all mobile devices that have been synced with mailboxes within your exchange environment.
First step is to gather a list of users that have an ActiveSync Device partnership
$userlist = gt-casmailbox -filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Get-Mailbox
This list of users is then used against the Get-ActiveSyncDeviceStatistics cmdlet to retrieve the associated ActiveSync devices with each users mailbox. We then select certain fields to reduce the amount of data and present it in the $report variable.
$report = $UserList | foreach { Get-ActiveSyncDeviceStatistics -Mailbox $_} | select Identity, LastSuccessSync, DeviceType, Status
You can also add the export-csv component onto the end of the command to export the $report contents to a .csv file
$report = $UserList | foreach { Get-ActiveSyncDeviceStatistics -Mailbox $_} | select Identity, LastSuccessSync, DeviceType, Status | export-csv -path "C:\ActiveSyncDevices.csv" -notype
Hints, tips, thoughts & findings on the world of Technology & Scripting
Showing posts with label mobile. Show all posts
Showing posts with label mobile. Show all posts
Friday, 16 September 2016
Friday, 9 September 2016
Get ActiveSync Enabled Accounts/Mailboxes using Powershell
Here is a short/simple script you can use to obtain a list of all mailboxes within your Exchange environment that have the ActiveSync service enabled on them.
#Add Exchange Cmdlets
add-pssnapin *exchange* -erroraction SilentlyContinue
get-casmailbox -resultsize unlimited | where {$_.ActiveSyncEnabled -eq $true}
The output will now be displayed showing all mailboxes in your environment that have ActiveSync functionality enabled on them.
You can export your results to a .csv by adding a bit more to the end of the command as per below. You can of course change the output path as required
get-casmailbox -resultsize unlimited | where {$_.ActiveSyncEnabled -eq $true} | select Name, ActiveSyncEnabled | export-csv "C:\activesyncusers.csv" -notype
#Add Exchange Cmdlets
add-pssnapin *exchange* -erroraction SilentlyContinue
get-casmailbox -resultsize unlimited | where {$_.ActiveSyncEnabled -eq $true}
The output will now be displayed showing all mailboxes in your environment that have ActiveSync functionality enabled on them.
You can export your results to a .csv by adding a bit more to the end of the command as per below. You can of course change the output path as required
get-casmailbox -resultsize unlimited | where {$_.ActiveSyncEnabled -eq $true} | select Name, ActiveSyncEnabled | export-csv "C:\activesyncusers.csv" -notype
Subscribe to:
Posts (Atom)