Size of a specific folder
I have script that I run weekly that gives me the top 100 mailboxes, totalitemsize and the size of the deleted items folder. I want to add the size of another folder called "Cabinet". Obviously not a default folder but it is one that all users have, it's always a top-level folder. Here is my top 100 - now 110 folder script. Is it possible to get the size of a non-default folder? # Script that reports on top 110 mailbox sizes - dot sourced in weekly-exchange.ps1 # # Main #HTML Output "<html>" "<body>" "<b><font size=5>E-mail Statistics Report</font></b>" #Todays date goes here" "<hr>" "<table>" "<tr>" "<td><font size=3><b><i>Top 100 Mailboxes</i></b></font></td><td></td>" "</tr>" "<tr>" "<td><hr>Mailbox<hr></td><td><hr>Size<hr></td><td></td><td><hr>Deleted Items<hr></td><td></td><td><hr>Quota<hr></td>" "</tr>" foreach ($mailbox in get-mailboxserver | get-mailboxstatistics | sort totalitemsize -descending | select -first 110){ $mailboxsize = $mailbox.TotalItemSize.Value.ToMB() $mbname = $mailbox.displayname $mbquota = $mailbox.storagelimitstatus $mbdeleted = $mailbox.TotalDeletedItemSize.Value.ToMB() #$mbcabinet = $mailbox.TotalDeletedItemSize.Value.ToMB() "<tr>" "<td>$mbname</td><td>$mailboxsize MB</td><td>| |</td><td>$mbdeleted MB</td><td>|</td><td>$mbquota</td>" "</tr>" } #Post "</body>" "</html>"
August 26th, 2011 5:09pm

You'll need to run get-mailboxfolderstatistics, and then filter out the results for the "Cabinet" folder.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2011 5:24pm

Yeah, that's where I'm hung up. I can get all folders and sizes but I'm hung up on the code to filter this one out.
August 26th, 2011 6:00pm

I think this will work: get-mailboxfolderstatistics <mailbox> | where {$_.identity -eq "\Cabinet"}[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2011 6:11pm

Get-MailboxFolderStatistics <mailbox> | where {$_.name -eq "Cabinet"} | ft Identity, Name, FolderSize Thanks mjolinor!
August 26th, 2011 6:28pm

Glad to help! I'm not at work today, so I couldn't test that.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2011 6:32pm

Okay, so now I want to use this with get-mailbox so I can pull the user alias. :) I don't know how to pull that from the first pipe get-mailbox <mailbox> | get-mailboxfolderstatistics | ft get-mailbox.alias, Name, FolderSize need in MB Something like this ? but the get-mailbox.alias doesn't pull the alias for get-mailbox
August 26th, 2011 6:35pm

Try this: foreach ($mbx in get-mailbox -resultsize unlimited){ get-mailboxfolderstatistics $mbx | ft @{Label="User";expression={$mbx.alias}},Name,@{Label="FolderSize(MB);expression={$_.totalitemsize / 1MB}} } Using calculated properties: http://technet.microsoft.com/en-us/library/ff730948.aspx[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2011 7:13pm

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

Other recent topics Other recent topics