Link to home
Start Free TrialLog in
Avatar of Christian Hans
Christian HansFlag for United States of America

asked on

Mass delete inbox rule from organization matching name 'main'

We were recently targeted for phishing emails and found quite a few employees got compromised.

As part of the attack, the BOT created a new Inbox Rule called "Main" and "Main1" into users profiles. This rule is to forward any/all email to an external source, delete any auto-replies sent back after the phishing email triggered back out to other contacts etc.

The one common factor is the rules all seemed to be called "Main" or "Mail1".

Is there a way to delete all mailbox rules in the organization that are named "Main"?

C:\> Get-Mailbox -ResultSize Unlimited | Remove-InboxRule -Identity "main"
The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
    + CategoryInfo          : InvalidArgument: (cdfgfdg, mansur:PSObject) [Remove-InboxRule], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Remove-InboxRule
    + PSComputerName        : ps.outlook.com
ASKER CERTIFIED SOLUTION
Avatar of Amit Kumar
Amit Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Christian Hans

ASKER

Amit, I just gave those commands a try and they didn't seem to work...

cmdlet Remove-InboxRule at command pipeline position 1
Supply values for the following parameters:
Cannot display the prompt for "Identity" because type "Microsoft.Exchange.Configuration.Tasks.InboxRuleIdParameter" cannot be loaded.
    + CategoryInfo          : ResourceUnavailable: (:) [], PromptingException
    + FullyQualifiedErrorId : System.Management.Automation.Host.PromptingException
    + PSComputerName        : ps.outlook.com
just to clarify, my given code is working with you right?