How to remove old retired or orphaned agents from DPM 2010

DId you remove/reinstall a Server which had a DPM Agent installed, without removing it from DPM before?

In DPM 2007 you could easily go on uninstall, the uninstall would fail, but it will ask you afterwards if you want

to remove the agent from the database. In DPM 2010 this behavior changed, the uninstall fails, and no option to remove the the orphaned agents.

This is what you may need to do if you get the following error.

o C:Program FilesMicrosoft DPMDPMbinRemove-ProductionServer.ps1 : DPM was unable to remove the protected computer DPM02 from one of the following groups:

1. Distributed COM users
2. DPMRADmTrustedMachines
3. MSDPMTrustedMachines
At line:1 char:30
+ .Remove-ProductionServer.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Remove-ProductionServer.ps1

Now remove all SIDs from the above groups, since the server was no longer in there by name due to domain removal. When you reran the command with the FQDN, you may receive the following error:

There is failure while removing production server
C:Program FilesMicrosoft DPMDPMbinRemove-ProductionServer.ps1 : DPM was unable to remove the protected computer DPM02.mydomain.com.
At line:1 char:30
+ .Remove-ProductionServer.ps1 <<<<
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Remove-ProductionServer.ps1

However, after refreshing the console, the agent is now removed.