We have created a script that gets each users mailbox size than send an email to user over a certain size. I am trying to pull just the number out but with no luck so far.
Examples: 878 MB (920,701,150 bytes), 808.3 MB (847,514,236 bytes), 722.5 MB (757,637,021 bytes)
I have tried using the .split to start at the beginning and end at the space because the size is variable in size.
Here is the sample code
$I = Get-MailboxStatistics -Identity <mailbox>
$U = Get-Mailbox -Identity <Mailbox>
$Size = $I.TotalItemSize
$SizeWK = $Size -split ' '
$SizeMB = $SizeWK -like 'MB'
If ($SizeMB -eq 'MB') {
$SizeNum = $Size.split(" ")[1]
}