Get AD OU structure

Get-ADObject -Filter { ObjectClass -eq ‘organizationalunit’ } |ft DistinguishedName, name |ft -AutoSize


Get primary and secondary mail address

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv E:\mailid.csv –NoTypeInformation



*The Primary SMTP address has a PrefixString of “SMTP” all others are a lower case “smtp”

Display Issue Warning Quota, Prohibit Send Quota & Prohibit Send Receive Quota in MB or GB with label

Get-MailboxDatabase | select-object Name,@{label=”IssueWarningQuota(MB)”;expression={$_.IssueWarningQuota.Value.ToMB()}},@{label=”Prohibit Send Quota(MB)”;expression={$_.ProhibitSendQuota.Value.ToMB()}},@{label=”Prohibit Send ReceiveQuota(MB)”;expression={$_.ProhibitSendReceiveQuota.Value.ToMB()}} |Export-Csv -Path E:\DBQuota.csv

How to fix Exchange 2010 DAG failed Content Index State.

The below cmdlet will give the failed status of Content Index State. Run the below cmdlet on second node of DAG:
Get-MailboxDatabaseCopyStatus | ? {$_.Status -ne “Mounted” -and $_.ContentIndexState -ne “Healthy”}

The below cmdlet will fix the Content Index State on the second node after a while:
Get-MailboxDatabaseCopyStatus | ? {$_.Status -ne “Mounted” -and $_.ContentIndexState -ne “Healthy”} | Update-MailboxDatabaseCopy –CatalogOnly