I am in the middle of an Exchange 2007 to 2013 migration and am moving mailboxes, doing lots of batch processes on mailboxes, accounts, etc. I have an issue where a handful of people I am running batch processes on fail.
For instance, a lot of my scripts for mass mailbox attribute changes (remove managedfoldermailboxpolicy, setting litigationhold and retentionpolicy, etc) do not work on certain users when running in a batch in powershell, but if I manually run the same command for the single user, it runs fine... here is an example of something that I can repeat the issue with:
Import-Csv -Path c:\cmbs2sg05users.csv | % {
$alias = $_.Alias
Set-Mailbox -Identity $alias -ManagedFolderMailboxPolicy:$null -LitigationHoldEnabled:$True -RetentionPolicy:$Null -UseDatabaseQuotaDefaults:$true -verbose
}
This will run fine for 99/100 users, but one specific user, I get this error
Set-Mailbox : The operation could not be performed because object 'USERNAME ' could not be found on domain controller 'SERVER-DC3.MYDOMAIN.LOCAL'.
At line:3 char:12
+ Set-Mailbox <<<< -Identity $name
+ CategoryInfo : InvalidData: (:) [Set-Mailbox], ManagementObjectNotFoundException
+ FullyQualifiedErrorId : D1CA8B3,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
If I run the command like this, for this user, it works fine
Set-Mailbox -Identity USERNAME -ManagedFolderMailboxPolicy:$null -LitigationHoldEnabled:$True -RetentionPolicy:$Null -UseDatabaseQuotaDefaults:$true -verbose
I thought initially it was perhaps a typo in my CSV file, but it is definitely NOT that. It is not just this one user, I am doing batches of 150 people at a time, and I usually get 1, sometimes 2 users that this occurs on, sometimes none... this is frustrating, any ideas? It's also not a replication issue, I can run the command and get the same errror result from multiple DC's for the same user. I thought it could also be a weird issue running this command from 2007 EMS vs 2013 EMS, same exact error.