Removing DPM Protection Agents from clients & DPM Admin Console via PowerShell

If like me you are running more than one backup solution (in my case Veeam & DPM) and you no longer have a requirement for DPM agents on selective hosts, you normally just have to right click on the agent within the DPM console and click Uninstall to remove the agent from both the console and the local machine. I have come across instances however whereby the console will not uninstall the agent (excluding the fact of course that you failed to remove the agent from a protection group).

If you run the below script from your DPM PS console you can force the removal of the agent software and entries in the DPM console. The only thing you need to do is specify the FQDN of the servers you wish to remove.

$computers = @("FQDN - Server1","FQDN - Server2")

foreach($server in $computers)
Get-WmiObject -Class Win32_Product -computer $server | Where-Object {$_.Name -like "*DPM*Agent*"} | ForEach-Object {$_.Uninstall()}
.\Remove-ProductionServer.ps1 -DPMServerName $env:computername -PSName $server

Note as always – use at your own risk.