Here are a few more Exchange PowerShell Commands:
Back up all the email address configured to a CSV file:
Get-Mailbox -ResultSize Unlimited | select -expand emailaddresses alias | EXPORT-CSV d:\exchangemigration\emailaddressesbackup.csv
Get all mailboxes where the 'Automatically update e-mail addresses based on e-mail address policy.' checkbox is enabled, and export to CSV:
Get-Mailbox -ResultSize
Unlimited | Where {$_.EmailAddressPolicyEnabled -eq $True} | Export-CSV D:\Export\emailaddresspolicy.csv
Get all mailboxes and email addresses assigned and export to CSV:
Get-Mailbox -ResultSize Unlimited | select -expand emailaddresses alias | EXPORT-CSV D:\Export\emailaddresses.csv
Identify where a Disabled/Deleted Mailbox is hosted, you can do this by executing the following command through the Exchange Management Shell:
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | ft displayname,database,disconnectreason -auto
This will generate a list of disconnected Mailboxes and you’ll see the Mailbox in the Disabled status if the account has been disabled. Or SoftDeleted if it has been deleted, these are l available for re connection due to the deleted Mailbox retention settings on the Database which by default is 30 days.
DisplayName Database DisconnectReason
----------- -------- ----------------
Neil Petersen DB3 SoftDeleted
TestMBX1 DB2 SoftDeleted
TestMBX4 DB7 SoftDeleted
(Accounts might take a few hours to show up or you can use the Clean-MailboxDatabase -Identity DB1 command where DB1 is the Mailbox database name to speed this up.)
You can then execute the following command to reconnect the Mailbox (note the -User is the account’s logon name, you can get this from AD users and Computers):
Connect-Mailbox -Identity "Neil Petersen" -Database DB3 -User PetersenNeil
Identify where a Disabled/Deleted Mailbox is hosted, you can do this by executing the following command through the Exchange Management Shell:
Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | ft displayname,database,disconnectreason -auto
This will generate a list of disconnected Mailboxes and you’ll see the Mailbox in the Disabled status if the account has been disabled. Or SoftDeleted if it has been deleted, these are l available for re connection due to the deleted Mailbox retention settings on the Database which by default is 30 days.
DisplayName Database DisconnectReason
----------- -------- ----------------
Neil Petersen DB3 SoftDeleted
TestMBX1 DB2 SoftDeleted
TestMBX4 DB7 SoftDeleted
(Accounts might take a few hours to show up or you can use the Clean-MailboxDatabase -Identity DB1 command where DB1 is the Mailbox database name to speed this up.)
You can then execute the following command to reconnect the Mailbox (note the -User is the account’s logon name, you can get this from AD users and Computers):
Connect-Mailbox -Identity "Neil Petersen" -Database DB3 -User PetersenNeil
Comments
Post a Comment