0

So basically I have a script whereby:

$MailboxArray = New-Object System.Object

$MailboxArray | Add-Member -MemberType NoteProperty -value $mail.issuewarningquota -Name WarningQuota

and where $mail:

$mail = get-mailbox -id $_

Now it works great in a For loop to get info for every mailbox in Exchange, but I would like the IssueWarningQuota output to be in MB and not GB.

I have a method in place for the TotalItemSize where:

TotalItemSize.value.ToMB()

But this doesn't/won't work for IssueWarningQuota, any way around this?

PnP
  • 3,133
  • 17
  • 62
  • 95

2 Answers2

1

I don't know the syntax for thoes exchange commands but if the TotoalItemSize is a number PowerShell is really good at calculating MB and GB.

Example:

PS C:\> $number = 4294967296
PS C:\> $number / 1GB
4
PS C:\> $number / 1MB
4096

So as long as it is a number like Int32 or Double you should be able to do something like that to it to convert to MB.

E.V.I.L.
  • 2,120
  • 13
  • 14
0
$MBXs = Get-Mailbox -Server Server01 -ResultSize unlimited |
 Where {$_.UseDatabaseQuotaDefaults -eq $false} 

 &{
 foreach ($MBX in $MBXs)
 {
  New-Object psobject -Property @{
   Displayname = $MBX.Displayname
   'WarningQuota (MB)' = ($MBX.IssueWarningQuota).Value.ToMB()
   'ProhibitSendQuota (MB)' = ($MBX.ProhibitSendQuota).Value.ToMB()
   'TotalItemSize (MB)' = (Get-MailboxStatistics $MBX).TotalItemSize.Value.ToMB()
   }
  }
 } | Select Displayname,'WarningQuota (MB)','ProhibitSendQuota (MB)','TotalItemSize (MB)'
mjolinor
  • 66,130
  • 7
  • 114
  • 135