Exchange 2007 Mailbox Listing by OU
Here we go again ... PowerShell for a GUI OS.
Today was one of those - we need this list of user names and email addresses but don't include this set of users and this other set of users. Simple Right? Well, not so much because the users don't have Departments specified in the account, and the OU structure looks like this:
Domain > AllStaff> Location > Users
So, here's how I got this list:
Get-Mailbox -resultsize unlimited -OrganizationalUnit "AllStaff" | where {-not (\(\_.organizationalunit -eq "Domain/AllStaff/Location/Users") -and -not (\)_.organizationalunit -eq "Domain/AllStaff/Other_Location/Users") } | select displayname,primarysmtpaddress |Export-CSV c:\temp\List.CSV
Handy No?