gpt4 book ai didi

powershell - 如何在 O365 中对我的邮箱统计信息进行排序?

转载 作者:行者123 更新时间:2023-12-04 07:22:19 25 4
gpt4 key购买 nike

我正在使用以下代码,我想按 TotalItemSize 排序。我没有得到想要的结果。

Get-Mailbox -RecipientTypeDetails usermailbox -resultsize 10 |
Get-MailboxStatistics | Sort-Object totalitemsize |
Format-Table totalitemsize
  • 结果如下:
  • TotalItemSize
    -------------
    22.7 GB (24,370,512,818 bytes)
    15.95 GB (17,130,688,417 bytes)
    7.84 GB (8,417,699,591 bytes)
    8.659 GB (9,297,263,477 bytes)
    27.36 GB (29,374,899,586 bytes)
    11.29 GB (12,119,583,472 bytes)
    2.103 GB (2,258,067,401 bytes)
    44.15 GB (47,409,766,670 bytes)
    21.08 GB (22,629,885,399 bytes)
    17.97 GB (19,296,711,234 bytes)

    最佳答案

    尝试使用这个:

    Get-Mailbox -RecipientTypeDetails usermailbox -Resultsize 10 |
    Get-MailboxStatistics |
    Sort-Object { [double][regex]::Matches($_.totalitemsize,'(?<=\()[\d,]+').Value } |
    Format-Table totalitemsize
    这是我在 regex 上的糟糕尝试请和我一起裸露。
    一旦我们捕获字节并将它们转换为 double[regex]::Matches(...) , Sort-Object应该能够处理它:
    @'
    22.7 GB (24,370,512,818 bytes)
    15.95 GB (17,130,688,417 bytes)
    7.84 GB (8,417,699,591 bytes)
    8.659 GB (9,297,263,477 bytes)
    27.36 GB (29,374,899,586 bytes)
    11.29 GB (12,119,583,472 bytes)
    2.103 GB (2,258,067,401 bytes)
    44.15 GB (47,409,766,670 bytes)
    21.08 GB (22,629,885,399 bytes)
    17.97 GB (19,296,711,234 bytes)
    '@ -split '\r?\n' |
    Sort-Object { [double][regex]::Matches($_,'(?<=\()[\d,]+').Value }

    2.103 GB (2,258,067,401 bytes)
    7.84 GB (8,417,699,591 bytes)
    8.659 GB (9,297,263,477 bytes)
    11.29 GB (12,119,583,472 bytes)
    15.95 GB (17,130,688,417 bytes)
    17.97 GB (19,296,711,234 bytes)
    21.08 GB (22,629,885,399 bytes)
    22.7 GB (24,370,512,818 bytes)
    27.36 GB (29,374,899,586 bytes)
    44.15 GB (47,409,766,670 bytes)

    关于powershell - 如何在 O365 中对我的邮箱统计信息进行排序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68414957/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com