I am repeatedly getting an error when I go to start a ComplianceSearch Via Powershell. Googling the error returns absolutely nothing somehow, and I have no idea where to start now.
- I have all the permissions. All of them. I'm a global admin.
- Sometimes it works.
- Once it throws the error, the search still gets started and will stay that way until I use Stop-ComplianceSearch. If it runs like that long enough (I have let it go for 2 days once), after stopped, the error is listed as an "internal error," but that doesn't show if stopped within the first 15 mins-1 hour.
- To continue after the error, I have to stop the search, restart my PC, use Set-ComplianceSearch to set the query again (it gets fully removed after the error), and start it again I want to keep searching via Powershell.
- Trying to start it from the O365 web console also occasionally gives me the same error after the glitch.
- Before 'resetting,' I can still do things like calling the details of the search via Get-ComplianceSearch, I can stop it, and I can change it via Set-ComplianceSearch.
- Occasionally after I stop it, if I do try to pull up details about the search I'll get an error that it can't find the search job at all, but that's less common.
- I am working in the ISE, but the same thing happens if I just start a standard powershell window.
- After asking the question on reddit, I have finally run into several people with the exact same issue (and no resolution), some report it is even more frequent than my own experience.
I am connecting via the following (I have MFA, our office is Allow Listed):
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName *** Email address is removed for privacy ***
Connect-IPPSSession -UserPrincipalName *** Email address is removed for privacy ***
My variables are set as follows:
PS T:\> $Choice
ps_test
PS T:\> $Query
received=2021-06-02..2021-06-09 AND from:*** Email address is removed for privacy *** AND subject:'delete me'
Then I set the existing search as follows without an error (new search or existing search, though, same problem):
PS T:\> Set-ComplianceSearch -Identity $Choice -ExchangeLocation All -ContentMatchQuery $Query
But when I start it, this is the error I get:
PS T:\> Start-ComplianceSearch -Identity $Choice
Unable to execute the task. Reason: Compliance search initialization for "ps_test" failed with exception: Failed to load binding information, jobRunId: 35b07815-413d-4461-6840-08d92b4a7061, missingBindings: [PublicFolderBinding,SharePointBinding]..
+ CategoryInfo : WriteError: (:) [], ComplianceJobTaskException
+ FullyQualifiedErrorId : [Server=BN3NAM04WS004,RequestId=e96ebcef-f43e-48af-8ce3-b7bf778d2d7b,TimeStamp=6/9/2021 1:28:17 PM] [FailureCategory=Cmdlet-ComplianceJobTaskException] 7C586E1
0
+ PSComputerName : nam04b.ps.compliance.protection.outlook.com
I don't even know where to start. Any ideas?
Edit: sometimes if I follow this with trying to start a new search, it is similar but different:
PS T:\> $Choice2 = "ps_test2"
PS T:\> New-ComplianceSearch -Name $Choice2 -ExchangeLocation All -ContentMatchQuery $Query
Name RunBy JobEndTime Status
---- ----- ---------- ------
ps_test2 NotStarted
PS T:\> Start-ComplianceSearch -Identity $Choice2
The operation couldn't be performed because 'ps_test2' couldn't be found.
+ CategoryInfo : WriteError: (:) [Start-ComplianceSearch], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : [Server=BN3NAM04WS004,RequestId=60eb65cd-191b-4a52-a167-2e91fca35748,TimeStamp=6/9/2021 1:43:08 PM] [FailureCategory=Cmdlet-ManagementObjectNotFoundException]
F9E610B8,Microsoft.Office.ComplianceJob.Tasks.StartComplianceSearch
+ PSComputerName : nam04b.ps.compliance.protection.outlook.com