Jump to content

Recommended Posts

Posted

I'm trying to run a powershell command to search through all mailboxes and remove emails that contain certain phrases.

 

For the most part it works except for a group of users (whom seem to be part of the same year group) which I am getting the following error:

 

The operation couldn't be performed because 'Person's Name' matches multiple entries.

+ CategoryInfo : InvalidArgument: (1354:Int32) [search-Mailbox], ManagementObjectAmbiguousException

+ FullyQualifiedErrorId : [server=LNXP123MB2537,RequestId=97478308-a835-4000-a3d6-c54a9f56f61c,TimeStamp=31/01/2019 17:56:01] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException] 5034CE5E,Microsoft.Exchange.Management.Tasks.SearchMailbox

+ PSComputerName : outlook.office365.com

 

 

I can access the mailbox and there is nothing with the account

 

Anyone any ideas?

 

Cheers

Posted (edited)

This is the command I am using

 

Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery "Display this message" -TargetMailbox "mdrabble" -TargetFolder "Phishing Emails" -LogLevel Full -DeleteContent -Force -Verbose

 

The command has worked on about 95% of users - it is only failing on a small number.

 

No other users have the same name and they only have the 1 account, so I am a little puzzled.

 

Get-Mailbox -Identity "Name" only shows 1 account

Edited by mdrabble
  • Thanks 1
Posted

Search-Mailbox -identity "Name" -SearchQuery Display this message" -TargetMailbox "mdrabble" -TargetFolder "Phishing Emails" -LogLevel Full -DeleteContent -Force -Verbose

 

Returns the same error.

Posted

The following might be worth a try if you don't have any luck with the other suggestions.

 

$Mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox,SharedMailbox -ResultSize Unlimited
$Mailboxes | ForEach {
   Search-Mailbox $_ -SearchQuery 'body:"Display this message"' -TargetMailbox "mdrabble" -TargetFolder "Phishing Emails" -LogLevel Full -DeleteContent -Force -Verbose
}

Posted
The following might be worth a try if you don't have any luck with the other suggestions.

 

$Mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox,SharedMailbox -ResultSize Unlimited
$Mailboxes | ForEach {
   Search-Mailbox $_ -SearchQuery 'body:"Display this message"' -TargetMailbox "mdrabble" -TargetFolder "Phishing Emails" -LogLevel Full -DeleteContent -Force -Verbose
}

 

Unfortunately, running as another admin didn't work and neither do the above method.

 

Will have a play over the weekend to see what is different on these accounts that get the error.

  • 1 year later...
Posted
Unfortunately, running as another admin didn't work and neither do the above method.

 

Will have a play over the weekend to see what is different on these accounts that get the error.

We're having the same issue, so pls update us.

Posted
Get the mailbox GUID then use that, that cannot be ambigous?

I'v already tried it. But it occaured same error.

what 'mailbox GUID' is?

that means exchangeGUID?

Posted

yeah

 

$MB=get-mailbox chaplic $MB.ExchangeGuidGuid----b053c8be-c0f5-4039-ab93-527a290f7920

 

 

But looks like you have that? Could they have an archive mailbox for some reason?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...