Help With EMS Script for Mailbox Usage
I wonder if someone could point me in the right direction for a script I'd like which would grab a users's TotalItemSize, then compare it to their IssueWarningQuota and present the result as a percentage. Something along the lines of "User is using 90% of quota (900MB/1000MB)" I can get the raw numbers with Get-MailboxStatistics and Get-Mailbox, but I'm not sure how to use mathmatical functions in powershell to do the math. Thanks
May 27th, 2011 5:30pm

This isn't trivial for a general script because you also have to look at the UseDatabaseQuotaDefaults property to see if the quota value from the mailbox database applies or the one from the mailbox applies. Maybe someday I'll write one that I can share with you, but right now I haven't done that. Seriously, you shouldn't post to a list asking someone to write a script for you. Few of us have time to develop scripts and give them away for free; it's enough that we share our expertise for free. Instead you should learn how to write it yourself, and then if you have problems, post for help with the problems and show what you have developed.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 5:55pm

Those quota and itemsize values aren't very math friendly. There may be easier ways, but this is what I came up with: $usedmb = (get-mailboxstatistics $user).totalitemsize $usedmb -match ".+\((.+)\)" > $nul $usedbytes = $usedmb -replace "[^\d]" $quotamb = (get-mailbox $user).prohibitsendquota $quotamb -match ".+\((.+)\)" > $nul $quotabytes = $quotamb -replace "[^\d]" $pct_used = [int](($usedbytes / $quotabytes) * 100) [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
May 27th, 2011 6:08pm

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

Other recent topics Other recent topics