Date created: Friday, August 27, 2010 7:59:44 PM. Last modified: Thursday, December 13, 2012 11:41:20 AM

List Primary SMTP Addresses

I like to keep on top of unused accounts but its difficult when you don't know the user. I use this command to gather lists of primary SMTP addresses by domain name. This way I can email the lists to those in charge of of the users who belong to that domain and see who needs the boot:

Get-AcceptedDomain Get-Mailbox | where {$_.Primarysmtpaddress -like "*@domain1.co.uk"} | fl Name,PrimarySMTPAddress > domain1.co.uk.txt

With this I have a small powershell script about 8 lines long, one entry per domain for which I route mail. I run this bi-monthly or monthly and I'm done!