Get specific information from Exchange 2007 into a file
Hi, I need to get the following information of all the mailboxes from Exchange 2007 into a txt file: Samaccountname Last logon (to the mailbox) Mailbox size Item Count Would the following cmdlet provide all the information I need? Get-MailboxStatistics | Format-List > C:\Stats.txt Or better use something like this? Get-MailboxStatistics | Select-Object DisplayName, LastLogonTime | Format-Table > C:\Stats.txt What would be the best cmdlet to use? Thanks in advance!
April 9th, 2011 3:57am

Get-MailboxStatistics | fl DisplayName, LastLogonTime, TotalItemSize, ItemCount > c:\stats.txt Get-MailboxStatics seems to be right cmdlet for that task, however it does not include sAMAccountName so I put Display Name instead, you can get sAMAccountName from AD by display name if you wantWith kind regards Krystian Zieja http://www.projectnenvision.com Follow me on twitter My Blog
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2011 4:16am

Hi Krystian, thank you very much for your help and very quick reply! Much appreciated! Kind regards, BQ
April 9th, 2011 4:42am

On Sat, 9 Apr 2011 08:08:03 +0000, Krystian.Zieja wrote: > > >Get-MailboxStatistics | fl DisplayName, LastLogonTime, TotalItemSize, ItemCount > c:\stats.txt That output will be difficult to use. It would probably be better to use something like this: Get-MailboxStatistics | select DisplayName, LastLogonTime, TotalItemSize, ItemCount | export-csv c:\stats.csv -notypeinfo >Get-MailboxStatics seems to be right cmdlet for that task, however it does not include sAMAccountName so I put Display Name instead, you can get sAMAccountName from AD by display name if you want If you need the account name then this will work: Get-MailboxStatistics | select @{n='Account';e={(get-mailbox $_.legacydn).samaccountname}},DisplayName, LastLogonTime, TotalItemSize, ItemCount | export-csv c:\temp\XXXX.csv -notypeinfo -encoding ascii Just remember that there will be mailboxes in the databases that are disconnected from AD Users, so not every mailbox will have an associated samaccountname. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
April 9th, 2011 12:31pm

Wow thank you very much Rich! Get-MailboxStatistics | select @{n='Account';e={(get-mailbox $_.legacydn).samaccountname}},DisplayName, LastLogonTime, TotalItemSize, ItemCount | export-csv c:\temp\XXXX.csv -notypeinfo -encoding ascii That gives exactly all the info that I need. Thanks again Rich, I really appreciate your help!! I hope someday I will know all this and will be able to return the favor! :-) Kind regards, BQ
April 9th, 2011 2:54pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics