0

我有一个简单的 PowerShell 脚本来在我们的日志邮箱上创建一封电子邮件报告:

$smtpServer = "1.2.3.4"
$from = "madeup@emailaddress.com"
$emailaddress = "madeup@emailaddress.com"
$subject = "Journaling Mailbox Report"
$mailboxreport = Get-MailboxFolderStatistics Journaling_mailbox | select Date, Name, FolderPath, FolderType, ItemsInFolder | ConvertTo-HTML
$body = "$mailboxreport"
Send-Mailmessage -smtpServer $smtpServer -from $from -to $emailaddress -subject $subject -body $body -bodyasHTML

现在,该脚本运行良好,但我想从日记邮箱中指定特定选择,而不是所有文件夹。我可以使用 -FolderScope 参数指定一个文件夹 - 是否可以将此参数用于多个文件夹,还是我必须做一些更复杂的事情?

4

1 回答 1

0

Folder scope only takes a single folder name for scope.

You can filter out multiple folders at once using a filter with an alternation regex:

$mailboxreport = Get-MailboxFolderStatistics Journaling_mailbox |
 select Date, Name, FolderPath, FolderType, ItemsInFolder |
 Where {$_.FolderPath -match '/(Folder1|Folder2)/'} |
 ConvertTo-HTML
于 2013-11-05T00:46:22.483 回答