简体   繁体   English

使用命令 Remove-InboxRule 删除规则

[英]Remove rules with command Remove-InboxRule

I would like to remove by filtering " Filter * " a massive rules.我想通过过滤“ Filter * ”来删除大量规则。 Have this command but can't run correctly有这个命令但是不能正常运行

Remove-InboxRule -Mailbox user@domain.com -Identity 'Filter *' -Confirm:$false

Is it possible?是否可以?

If I'm reading this correctly you want to remove all rules from a mailbox.如果我没看错,您想从邮箱中删除所有规则。 The identity parameter doesn't allow for wildcards, so in that regard there is no filtering capability. identity 参数不允许使用通配符,因此在这方面没有过滤功能。 -Identity does support pipeline input, so you can however pipe the results of Get-InboxRule: -Identity 确实支持管道输入,因此您可以通过管道传输 Get-InboxRule 的结果:

Get-Mailbox user@domain.com | Get-InboxRule | Remove-InboxRule -WhatIf

OR:或者:

Get-InboxRule -Mailbox user@domain.com | Remove-InboxRule -WhatIf

You can insert additional filtering via a Where clause between Get-InboxRule and Remove-InboxRule:您可以通过 Get-InboxRule 和 Remove-InboxRule 之间的 Where 子句插入附加过滤:

Example:例子:

Get-Mailbox user@domain.com | Get-InboxRule | Where{$_.MoveToFolder -eq "Junk E-Mail"} | Remove-InboxRule -WhatIf

I have to caution you that any rules that had been un-checked in Outlook will get deleted any time you change rules from the shell I've worked on this a lot in the past and the only API that seems not to have this issue is the Outlook Object Model.我必须提醒您,任何在 Outlook 中未选中的规则都会在您更改 shell 中的规则时被删除我过去曾为此做过很多工作,唯一似乎没有此问题的 API 是Outlook 对象模型。 ESM, EWS, CDO & RDO (deprecated as they are) all have the same issue. ESM、EWS、CDO 和 RDO(已弃用)都存在相同的问题。 So if you are just trying to wipe everything you're good, but if you're filtering first, exercise caution.因此,如果您只是想擦除所有内容,那很好,但如果您先进行过滤,请谨慎行事。

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

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