MUSINGS

Powershell script to find files recursively and export to CSV

Powershell script to find files recursively and export to CSV

The following script takes 3 input’s the directory to start searching from, the file extesion we are searching for (eg. .xml) and the file name to output the results as CSV to. If a result file isn’t supplied then the results are dumped to the screen. The most interesting part of this script is this @{Name=”MB”;expression={“{0:N2}” -f ($_.LengthRead more about Powershell script to find files recursively and export to CSV[…]

Powershell script to export Exchange mailbox sizes as a CSV

Powershell script to export Exchange mailbox sizes as a CSV

The following one liner will export all mailboxes with size details to a csv file. Save it at as a .ps1 script for ease of use. Get-MailboxStatistics | where {$_.ObjectClass -eq “Mailbox”} | Sort-Object TotalItemSize -Descending | select-object @{expression={$_.DisplayName}},@{expression={$_.TotalItemSize.Value.ToMB()}},@{expression={$_.ItemCount}},@{expression={$_.StorageLimitStatus}} | Export-Csv mailboxes.csv