简体   繁体   English

简化“Get-Mailbox| 选择 ProhibitSendQuota”的输出 - Exchange、Powershell

[英]Simplify output of "Get-Mailbox| select ProhibitSendQuota" - Exchange, Powershell


I was wondering how i could get the output from Get-Mailbox| select ProhibitSendQuota我想知道如何从Get-Mailbox| select ProhibitSendQuota输出Get-Mailbox| select ProhibitSendQuota without the size displayed in Bytes behind GB? Get-Mailbox| select ProhibitSendQuota没有以字节为单位显示的大小在 GB 之后?

if you run Get-Mailbox| select ProhibitSendQuota如果您运行Get-Mailbox| select ProhibitSendQuota Get-Mailbox| select ProhibitSendQuota , you get something like: Get-Mailbox| select ProhibitSendQuota ,你会得到类似的东西:

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.但它会使它更加干净和可读。

The solution was as @AdminOfThings commented.解决方案就像@AdminOfThings 评论的那样。

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!效果很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM