I am working on a PS script to convert an ExchangeOnline user mailbox to a shared mailbox and would like to implement a safety check. The user mailbox must be under 50GB to be converted to a shared mailbox.
$upn = Read-host -Prompt "Input the UPN of the user you would like to convert. ex. [email protected]
->"
$mailboxsize = get-mailboxstatistics $upn | select TotalItemSize
In this instance
$mailboxsize
returns:
TotalItemSize
-------------
XX.X GB (XX,XXX,XXX,XXX bytes)
I would like to remove everything after "XX.XX" so that I can use a if/then with a comparitor to either display an error or continue the script. Tried doing some research but not really sure how to word this to get the results I'm after.
This is my first post/question apologies if its in the wrong place/etc. Let me know if I am doing something wrong with formatting or anything else.
Various -arguments Comparing XX.X GB (XX,XXX,XXX,XXX bytes) to XX.X GB (XX,XXX,XXX,XXX bytes)
@lit The EXO command works for my application, I guess you can use .Value there but not with the Get-Mailboxstatistics cmlet. I was able to test it and it works great!