Powershell – Exchange Retention Policy cannot be run manually

exchange-2010powershell

I am trying to test an Exchange 2010 retention policy that deleted items in the deleted items after 365 days. Exchange is fully patched.

When I run Start-ManagedFolderAssistant -Identity “Administrator” it runs successfully. If I run
Start-ManagedFolderAssistant to run this against the whole server, I am prompted to enter the server name and then get the below error. The same error occurs using the -Identity switch.

The operation couldn't be performed because object 'FQDN Of Exchange' couldn't be found on FQDN Of One of our DC’s'.
    + CategoryInfo          : NotSpecified: (0:Int32) [Start-ManagedFolderAssistant], ManagementObjectNotFoundExceptio
   n
    + FullyQualifiedErrorId : 9FFD81F9,Microsoft.Exchange.Management.SystemConfigurationTasks.StartElcAssistant

I have checked that there is an entry in the DC For the Exchange server.

There are no errors in the DNS logs. I have also forced a AD Replciation and a DNS Replcation in the Domain. I have also waited for a number of hours so the Domain Controllers will do replication naturally as well.

Why is this happening?

Best Answer

The reason is that the required parameter Identity on the Start-ManagedFolderAssistant cmdlet expects a Mailbox identity as input.

If you want it to process all mailboxes on a given mailbox server, you can do it like this:

$allMailboxes = Get-MailboxServer -Identity "mailboxserver.domain.tld" | Get-Mailbox -ResultSize unlimited 
$allMailboxes | Start-ManagedFolderAssistant