Announcement

Collapse
No announcement yet.

Export Mailboxes to .csv

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Export Mailboxes to .csv

    I need to be able to see all the columns that the shell exports to .csv.
    My script that I use looks like this;

    $mailboxes=get-mailbox -organization "OU" -results Unlimited
    $results=ForEach($mb in $mailboxes){
    $stats=get-mailboxstatistics $mb
    $props=@{
    DisplayName=$mb.displayname
    WindowsEmailAddress=$mb.WindowsEmailAddress
    TotalItemSize=$stats.totalitemsize
    ProhibitsendReceiveQuota=$mb.ProhibitsendReceiveQu ota
    }
    New-Object PsObject -Property $props
    }
    $results | Sort-Object TotalItemSize -descending | ft -autosize > c:\temp\OU.csv



    This successfully exports all the details to .csv however all the email addresses in the last column is incomplete eg. "user@compan......", "info@c......."
    I've tried posting on other forums also and can't get a working script to get all my data required to see what's going on in the organization. Unless I manually type out all the addresses I see in OWA.

    see this thead; https://social.technet.microsoft.com...changesvradmin

  • #2
    Remove the FT and pipe directly to EXPORT-CSV
    You are pre-formatting the output so will lose some data

    Your last line should read $results | Sort-Object TotalItemSize -descending | export-csv c:\temp\OU.csv
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment

    Working...
    X