Help with Exchange 2007 Console Command
Hi all, I need to make a file that lists the following for all of my Exchange 2007 users: Name, EmailAddress, LastLogonTime I can get their name and lastlogon time by doing: get-mailboxstatistics | select-object Displayname, LastLogonTime, however I am not sure how to sneak their email address in there as well. Any help is appreciated.
July 7th, 2009 10:13pm
Get-MailboxStatistics doesn't give email address in output so you need to get it from Get-Mailbox or any otherequivalentcmdlet and add into same output like below...
Get-MailboxStatistics | Select-Object Displayname, LastLogonTime,@{Name="EmailAddress";expression={(Get-Mailbox $_).PrimarySMTPAddress}}Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
July 8th, 2009 5:44am
Amits cmdlet is basically correct, I tested in the lab and modified a little bit:
Get-MailboxStatistics | Select-Object Displayname,LastLogonTime,@{Name="EmailAddress";expression={Get-Mailbox $_.Displayname | Select-Object PrimarySMTPAddress}} | ft -wrap
July 8th, 2009 6:55am
You're welcome...! :)Amit Tank | MVP Exchange Server | MCITP: EMA | MCSA: M | http://ExchangeShare.WordPress.com
July 8th, 2009 3:56pm