mdrabble Posted January 31, 2019 Posted January 31, 2019 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
mdrabble Posted January 31, 2019 Author Posted January 31, 2019 (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 January 31, 2019 by mdrabble 1
snagrat Posted January 31, 2019 Posted January 31, 2019 Can you do an individual search on a problematic mailbox and insert the -Identity switch? Rather than piping it from Get-Mailbox
mdrabble Posted January 31, 2019 Author Posted January 31, 2019 Search-Mailbox -identity "Name" -SearchQuery Display this message" -TargetMailbox "mdrabble" -TargetFolder "Phishing Emails" -LogLevel Full -DeleteContent -Force -Verbose Returns the same error.
snagrat Posted January 31, 2019 Posted January 31, 2019 In -Identity are you using the full email address?
mdrabble Posted January 31, 2019 Author Posted January 31, 2019 I've tried Username, Full Name, and full email address - all return the same error.
tech-man Posted January 31, 2019 Posted January 31, 2019 I saw this today, logged in with a different O365 admin and it worked
mdrabble Posted January 31, 2019 Author Posted January 31, 2019 Will try with a different admin in the morning.
Arthur Posted January 31, 2019 Posted January 31, 2019 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 }
mdrabble Posted February 1, 2019 Author Posted February 1, 2019 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.
ciscons Posted February 4, 2020 Posted February 4, 2020 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.
chaplic Posted February 4, 2020 Posted February 4, 2020 Get the mailbox GUID then use that, that cannot be ambigous?
ciscons Posted February 4, 2020 Posted February 4, 2020 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?
chaplic Posted February 4, 2020 Posted February 4, 2020 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?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now