none
get-mailbox stats to file RRS feed

  • Question

  • Looking for a get-mailbox pscript that will extract firstname, lastname, accountname, title, mailbox size to a file for ex2010 users/mailboxes? 

    thanks in adv.

    Monday, November 19, 2012 8:33 PM

Answers

  • Hi

    Please use command "Export-CSV <Path>" to export, dont forget put a pipe.

    For title, which one do you want, I saw there was a displayname in your command

    Cheers


    Zi Feng

    TechNet Community Support

    • Marked as answer by WildPacket Tuesday, November 20, 2012 3:27 PM
    Tuesday, November 20, 2012 9:11 AM
    Moderator
  • thanks zi ...

    this worked ..

    Get-MailboxStatistics -server bljcmarxdn001 | where {$_.objectClass -eq "Mailbox"} |Sort-object totalitemsize -descending |Select-Object displayname,@{Name='Title'; Expression={[String]::join(";",((Get-User -identity $_.displayname).title))}},@{expression={$_.TotalItemSize.Value.ToMB()}}, itemcount,storagelimitstatus | Export-csv C:\temp\TitleMBXUser.csv

    • Marked as answer by WildPacket Thursday, November 22, 2012 12:50 PM
    Thursday, November 22, 2012 12:50 PM

All replies

  • I put together this and seems to work pretty well ...

    Get-MailboxStatistics -server exch2010 | where {$_.objectClass -eq "Mailbox"} |Sort-object totalitemsize -descending |ft displayname,@{expression={$_.TotalItemSize.Value.ToMB()}},itemcount,storagelimitstatus -auto

    Looking to get a title of the users and export to csv ....

    • Edited by WildPacket Monday, November 19, 2012 9:29 PM
    Monday, November 19, 2012 8:58 PM
  • Hi

    Please use command "Export-CSV <Path>" to export, dont forget put a pipe.

    For title, which one do you want, I saw there was a displayname in your command

    Cheers


    Zi Feng

    TechNet Community Support

    • Marked as answer by WildPacket Tuesday, November 20, 2012 3:27 PM
    Tuesday, November 20, 2012 9:11 AM
    Moderator
  • Thanks Zi for your response.  That helped and I get the data in CSV now.

    For title I want is their job title ...e.g:  VP of IT, Manager etc it is poulated in Exchange under the organization tab.  help pplz!


    • Edited by WildPacket Tuesday, November 20, 2012 2:11 PM
    Tuesday, November 20, 2012 1:12 PM
  • Hi

    That is one field in Get-User

    So, try below command

    Get-MailboxStatistics -server exch2010 | where {$_.objectClass -eq "Mailbox"} |Sort-object totalitemsize -descending |ft displayname,@{Name='Title'; Expression={[String]::join(";",((Get-User -identity $_.displayname).title))}},@{expression={$_.TotalItemSize.Value.ToMB()}},itemcount,storagelimitstatus -auto

    Cheers


    Zi Feng

    TechNet Community Support

    Wednesday, November 21, 2012 2:15 AM
    Moderator
  • Thanks Zi.

    It works great ...but I am trying to export it to csv file and I get all gibberish in the file...

    Wednesday, November 21, 2012 1:39 PM
  • Hi

    Which part got garbage characters?

    That is because when export to pst, the output did not automatically changed to string format

    The solution is change the gibberish part using  “.toString()”

    Please try

    Get-MailboxStatistics -server exch2010 | where {$_.objectClass -eq "Mailbox"} |Sort-object totalitemsize -descending |ft displayname,@{Name='Title'; Expression={[String]::join(";",((Get-User -identity $_.displayname).title.toString()))}},@{expression={$_.TotalItemSize.Value.ToMB().toString()}},itemcount,storagelimitstatus -auto

    Cheers


    Zi Feng

    TechNet Community Support

    Thursday, November 22, 2012 1:49 AM
    Moderator
  • thanks zi ...

    this worked ..

    Get-MailboxStatistics -server bljcmarxdn001 | where {$_.objectClass -eq "Mailbox"} |Sort-object totalitemsize -descending |Select-Object displayname,@{Name='Title'; Expression={[String]::join(";",((Get-User -identity $_.displayname).title))}},@{expression={$_.TotalItemSize.Value.ToMB()}}, itemcount,storagelimitstatus | Export-csv C:\temp\TitleMBXUser.csv

    • Marked as answer by WildPacket Thursday, November 22, 2012 12:50 PM
    Thursday, November 22, 2012 12:50 PM