July 2017
Intermediate to advanced
648 pages
31h 9m
English
Finding unused mailboxes in your environment might be as simple as searching for disabled user accounts in Active Directory that are mailbox-enabled. If that is the case, you can use the following one-liner to discover these mailboxes:
Get-ADUser -Filter {Enabled -eq $False -and mail -like "*"} | `ForEach {Get-Mailbox $_.SamAccountName -ErrorAction SilentlyContinue | `? {$_.RecipientTypeDetails -eq "UserMailbox"}} | `Select DisplayName, SamAccountName, PrimarySmtpAddress
This command uses the Get-ADUser cmdlet to search through all disabled Active Directory accounts. We include only those that have a mailbox by ensuring the mail attribute is populated. This is not strictly necessary, but it will save us time by not passing ...
Read now
Unlock full access