Powershell get-mailboxfolderstatistics多个文件夹

时间:2014-03-13 07:21:30

标签: powershell scripting exchange-server powershell-v2.0

我有这个脚本。希望在输出中包含,删除的项目,已发送的项目和草稿。

包含它的最佳方式是什么?

由于

Get-MailboxFolderStatistics myuserename -FolderScope Inbox | Where {$_.FolderPath -eq "/Inbox"}

2 个答案:

答案 0 :(得分:0)

我所知道的最简单的方法是一次过滤多个文件夹是使用-match和正则表达式替换:

Get-MailboxFolderStatistics myuserename |
 Where {$_.FolderPath -match  '/Inbox|/Deleted Items|/Sent Items|/Drafts'}

答案 1 :(得分:0)

get-mailboxfolderstatistics myusername |其中{$ _。name -match" Inbox | Deleted | Sent | Calendar | Drafts"} | sort-object名称| ft Name,FolderPath,ItemsInFolder,FolderSize -auto