Created
September 10, 2019 17:00
-
-
Save ThoZed/e3c7d392ab42db42b463b44a1dcbe086 to your computer and use it in GitHub Desktop.
msExchange_list_MobileDeviceStatistics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# PSSnapin Load | |
if ( (Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue) -eq $null ) | |
{ | |
Add-PsSnapin Microsoft.Exchange.Management.PowerShell.E2010 | |
} | |
# | |
# Create list with MobileDeviceStatistics for each mailbox extend output with Mailbox and MailboxUser | |
# | |
$UserList = Get-CASMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Get-Mailbox | |
$UserList | foreach { | |
$User = $_ | |
Get-MobileDeviceStatistics -Mailbox $_} | fl @{l='Mailbox';e={$User.SamAccountName}},@{l='MailboxUser';e={[regex]::Match($_.Identity,'^.+/(.+)/ExchangeActiveSyncDevices/.+').Captures.groups[1].value}},* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment