Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Extracting number fields read from a CSV file

$
0
0

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]
}


Viewing all articles
Browse latest Browse all 8583

Trending Articles