Skip to content

Instantly share code, notes, and snippets.

@alexinnes
Last active August 29, 2015 14:21
Show Gist options
  • Save alexinnes/ede23fbd07668d2426c2 to your computer and use it in GitHub Desktop.
Save alexinnes/ede23fbd07668d2426c2 to your computer and use it in GitHub Desktop.
Gets Mailboxes from specified server, lists: Name, last login time, size and which server its located on.
#Database name you want to get all mailboxes from
#Add * on the end for a wildcard
$database = "PER*"
#Output File name
$Filename = "Export.csv"
#Where you want to export the file
$Path = "C:\"
$export = "$Filename$Path"
#Gets all mailboxes in specified database, returns them with Name, How big they are, their last log in time and where they are located. and outputs them to a CSV
get-mailbox | where{$_.database -like "$database"} |get-mailboxstatistics| select -Property displayname, totalitemsize, lastLogonTime, servername | export-csv $export
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment