我有一个简单的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参数指定一个文件夹--是否可以在多个文件夹中使用这个参数,还是需要做一些更复杂的事情?
发布于 2013-11-05 00:46:22
文件夹作用域仅采用单个文件夹名称作为作用域。
您可以使用带有交替regex的筛选器一次过滤出多个文件夹:
$mailboxreport = Get-MailboxFolderStatistics Journaling_mailbox |
select Date, Name, FolderPath, FolderType, ItemsInFolder |
Where {$_.FolderPath -match '/(Folder1|Folder2)/'} |
ConvertTo-HTMLhttps://stackoverflow.com/questions/19777160
复制相似问题