I was wondering how i could get the output from Get-Mailbox| select ProhibitSendQuota
without the size displayed in Bytes behind GB?
if you run Get-Mailbox| select ProhibitSendQuota
, you get something like:
ProhibitSendQuota
-----------------
49.5 GB (53,150,220,288 bytes)
49.5 GB (53,150,220,288 bytes)
49.5 GB (53,150,220,288 bytes)
I would like the output to look more like (If possible):
ProhibitSendQuota
-----------------
49.5 GB
49.5 GB
49.5 GB
Any help with this would be very nice! its not a dealbreaker. but it would makes it so much more clean and readable.
CodePudding user response:
The solution was as @AdminOfThings commented.
Get-Mailbox| select @{n='ProhibitSendQuota';e={$_.ProhibitSendQuota -replace '\s*\(.*$' }}
I'm using it within this
$Result = New-Object -TypeName PSObject -Property $([ordered]@{
UserName = $mbx.DisplayName
Epost = $mbx.UserPrincipalName
ArchiveStatus = $mbx.ArchiveStatus
ArchiveName = $mbx.ArchiveName
ArchiveState = $mbx.ArchiveState
MailBoxQuota = $mbx.ProhibitSendQuota -replace '\s*\(.*$'
'Archive Size (GB)' = $size
ArchiveWarningQuota = if ($mbx.ArchiveStatus -eq "Active") { $mbx.ArchiveWarningQuota } Else { $null }
ArchiveQuota = if ($mbx.ArchiveStatus -eq "Active") { $mbx.ArchiveQuota -replace '\s*\(.*$'} Else { $null }
AutoExpArchive = $mbx.AutoExpandingArchiveEnabled
'TotalItemSize (GB)' = [math]::Round((($mbs.TotalItemSize.Value.ToString()).Split("(")[1].Split(" ")[0].Replace(",", "") / 1GB), 2)
ItemCount = $mbs.ItemCount
LastLogonTime = $mbs.LastLogonTime
}
and it works great!