Monday, June 30, 2014

Exchange 2010/2013 Delegates Report

One of the most important guidelines when moving mailboxes to the cloud is to make sure that you move mailboxes along with their delegates in the same batches to avoid issues. Rajkumar-MCITP has made this script a while back that worked very well.
However, I recently found that it didn't work as well as it once had for me in Exchange 2007. Here's the issues I had getting this to work.
  • For Exchange 2010/2013, you need to change get-MailboxCalendarSettings to get-mailboxCalendarConfiguration
  • The output file path is c:\MailboxReport.csv and the $attachment value is c:\temp\DelegatesReport.csv in the send-mailmessage cmdlet.  They'd need to match for the attachment to come through. 
  • In order for mail to work, you'll need to modify the $ToAddress and $fromAddress fields as well as the SMTP server in the send-mailmessage command
  • Additionally, if you don't have your localhost configured to accept the email, you likely won't get the file emailed to you.  Easier to just grab the CSV file to be honest.
  • Then, I noticed that the CSV had no delegates in the delegate column.


So I spent some time to find a better way to gather this data.


Here's the powershell one-liner:


Get-Mailbox -ResultSize unlimited | Get-CalendarProcessing | where { $_.ResourceDelegates -ne "" } | Select-Object identity,@{Name='ResourceDelegates';Expression={[string]::join(",", ($_.ResourceDelegates))}} | Export-csv -Path c:\temp\ResourceDelegates.csv
It doesn't email you, but if you want a second line to Send-MailMessage, you can easily add that.

No comments: