Hi All,

Within the SCOM console there is the option to Uninstall, Repair and Delete an agent from the Agent Managed view.  However, when using the Operations Manager cmdlets in PowerShell, it is only possible to Uninstall or Repair.  In most cases these options are fine, but there are times when servers go offline unexpectantly, or as part of certain processes, where an agent needs to be Deleted from the SCOM management group.

As there is no cmdlet to delete an agent, the SDK will need to be used in order to achieve this.  This script below will delete any single agent specified.


The script as shown above performs what I need it to as part of an Orchestrator runbook, however it could easily be turned into a function and extended to deal with multiple agent deletions at the same time.

You can also download a copy of the script here.

Good luck!