Share via

Software update errors sccm sql query

Boopathi S 3,906 Reputation points
2026-03-11T22:09:33.8466667+00:00

Hello Team,

I need to generate deployment report for 12 deployments of a software update group.

I tried the below query. But v_AssignmentStatus is not found in SCCM.

Screenshot 2026-03-12 033810

Please share the SQL query if anyone have it.

SELECT

vrs.Name0 AS 'MachineName',

ui.ArticleID AS 'UpdateID',

ui.Title AS 'UpdateTitle',

assc.LastEnforcementMessage AS 'LastEnforcementMessage', -- This column gives a description of the last enforcement message

assc.LastEnforcementErrorCode AS 'LastEnforcementErrorCode', -- This column contains the actual error code

assc.LastEnforcementMessageTime AS 'LastEnforcementTime'

FROM

v_R_System AS vrs

JOIN

v_AssignmentStatus AS assc ON vrs.ResourceID = assc.ResourceID

JOIN

v_UpdateInfo AS ui ON assc.CI_ID = ui.CI_ID

WHERE

assc.LastEnforcementErrorCode <> 0 -- Filters for records where an error occurred (0 means success)

AND assc.AssignmentID = 'YOUR_DEPLOYMENT_ID' -- OPTIONAL: Replace 'YOUR_DEPLOYMENT_ID' with the specific deployment unique ID

ORDER BY

assc.LastEnforcementTime DESC;
Microsoft Security | Intune | Configuration Manager | Deployment
0 comments No comments
{count} votes

Answer accepted by question author
  1. Q&A Assist
    2026-03-11T22:09:59.48+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The view name in the query is incorrect. For software update deployment status and error information, use the software‑update state and assignment views that are documented for Configuration Manager.

    For deployment‑level status (per assignment and device), use v_UpdateAssignmentStatus or v_UpdateAssignmentStatus_Live. For per‑update compliance on each client, use v_UpdateComplianceStatus together with v_UpdateInfo and v_R_System. State names come from v_StateNames.

    A pattern that matches what the query is trying to do is:

    SELECT
        rs.Name0                    AS MachineName,
        ui.ArticleID                AS UpdateID,
        ui.Title                    AS UpdateTitle,
        uas.LastEnforcementMessageID AS LastEnforcementStateID,
        sn.StateName                AS LastEnforcementMessage,
        uas.LastEnforcementErrorCode,
        uas.LastEnforcementMessageTime AS LastEnforcementTime,
        uas.AssignmentID
    FROM v_R_System              AS rs
    JOIN v_UpdateAssignmentStatus AS uas
        ON rs.ResourceID = uas.ResourceID
    JOIN v_UpdateInfo            AS ui
        ON uas.CI_ID = ui.CI_ID
    LEFT JOIN v_StateNames       AS sn
        ON sn.StateID   = uas.LastEnforcementMessageID
       AND sn.StateType = 301      -- enforcement state for deployments
    WHERE
        uas.LastEnforcementErrorCode <> 0
        AND uas.AssignmentID IN (/* list the 12 AssignmentIDs here */)
    ORDER BY
        uas.LastEnforcementMessageTime DESC;
    

    Key points:

    • v_AssignmentStatus is not a documented view; use v_UpdateAssignmentStatus or v_UpdateAssignmentStatus_Live instead.
    • LastEnforcementMessageID in v_UpdateAssignmentStatus is the state ID for topic type 301 (deployment enforcement). Join it to v_StateNames on StateID and StateType = 301 to get the friendly description.
    • v_UpdateInfo provides ArticleID and Title for each update (CI_ID).
    • Filter by AssignmentID for the specific deployments (the 12 deployments of the software update group).

    If per‑update compliance per client is required rather than deployment‑level status, use v_UpdateComplianceStatus joined to v_UpdateInfo, v_R_System, and v_StateNames in a similar way, using CI_ID, ResourceID, Status, and LastEnforcementMessageID as documented.

    For a ready‑made view of deployment errors similar to the built‑in “Troubleshooting 2 – Deployment errors” report, the recommended approach is to use the existing software update troubleshooting reports under Software Updates reports, especially Troubleshooting 2 - Deployment errors, which already aggregates deployment errors and affected computer counts.


    References:

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.