I am trying to update a mailbox search using a powershell script:
Stop-MailboxSearch -Identity "LitHolds" -confirm:$false $members = (import-csv -Path "Path"| ForEach-Object{$_.SamAccountName}) foreach ($user in $members) { Set-MailboxSearch -Identity "LitHolds" -SourceMailboxes $user.samaccountname } Start-MailboxSearch -Identity "LitHolds" -confirm:$false
I essentially have our sysadmins populating a csv file and then they run this script manually every night with the latest updates. They are telling me that the mailbox search is empty.
When I run the script I am getting a watson error immediately after with the following:
WARNING: An unexpected error has occurred and a Watson dump is being generated: Value cannot be null.
Parameter name: legacyDN
Value cannot be null.
Parameter name: legacyDN
+ CategoryInfo : NotSpecified: (:) [Stop-MailboxSearch], ArgumentNullException
+ FullyQualifiedErrorId : System.ArgumentNullException,Microsoft.Exchange.Management.Tasks.StopMailboxSearch
+ PSComputerName : Exchange Server Name
What I don't understand is why it's looking for a legacyDN??
Anyone able to do something similar?
Chuck