Automatic Deployment Rule failing with error 0x87d20003

Recently, one of our ADRs has been failing with error code 0x87d20003 and description “SQl Error”:

The ruleengine.log shows:

GetTargetCollectionID failed with error:-2016280573

-2016280573 in decimal translates to 0x87d20003.

Using the information in https://www.reddit.com/r/SCCM/comments/6zverb/deleting_collection_used_in_adr_breaks_deployments/, I wrote the following to show what Collection is missing:

declare @ADRName varchar (200) = 'Auto Monthly Patches'
select
   Data.value('(/DeploymentCreationActionXML//CollectionId/node())[1]', 'nvarchar(max)') CollectionID
 , c.CollectionID
 , c.Name
from RuleActions ra
left join v_Collection c on c.CollectionID = Data.value('(/DeploymentCreationActionXML//CollectionId/node())[1]', 'nvarchar(max)')
where ra.RuleID = (select AutoDeploymentID from vSMS_AutoDeployments where Name = @ADRName)
and ra.Name = 'DeploymentTemplate'

The NULL value shows the missing collection ID.

The only supported way to fix this is to delete the ADR and create anew.

7 thoughts on “Automatic Deployment Rule failing with error 0x87d20003

  1. i don’t know if it is supported, but i was find a way to fix Automatic Deployement Rule:
    1 : Execute powershell cmdlet “Set-CMSoftwareUpdateAutoDeploymentRule -Name “ADR Name” -CollectionName “DesiredCollection”
    2 : check deployments and delete duplicated deployements.
    et voilà

    But your SQL Script will have helped me to find the way. many thanks

    Like

  2. Hi, trying to run this query and keep getting Msg 2205, Level 16, State 1, Line 7
    XQuery [RuleActions.Data.value()]: “)” was expected.

    Any ideas?
    Thanks

    Like

    1. Weird… did you copy/paste? Maybe somehow it’s not copying the second close parenthesis after the node() method… I get this message if I have:

      node()[1]

      it should be:

      node())[1]

      note the two close parenthesis.

      Like

      1. Yes, I was able to get it to work.
        Trying to correct the issue by using indiano’s solution doesn’t seem to work. It just creates the deployment, replacing one that exists (repeatedly doing the same thing) Any ideas?

        Thanks

        Like

Leave a reply to George Cancel reply