Hi, @Sathish Raj S
Thank you for posting in Microsoft Q&A forum.
We have to use different sql query for Packages / Applications / Software updates.
Here is an example for software updates, replace 'ComputerName' with your device name:
DECLARE @ComputerName nvarchar(30) = 'ComputerName'
when ds.FeatureType = 1 then 'Application'
when ds.FeatureType = 2 then 'Program'
when ds.FeatureType = 5 then 'Software Update'
end as 'FeatureTypeText',
ca.AssignmentName as DeploymentName,
sn.StateName as LastEnforcementState
from v_DeploymentSummary ds
inner join v_CIAssignment ca on ca.AssignmentID=ds.AssignmentID
inner join v_AssignmentState_Combined assc on ca.AssignmentID=assc.AssignmentID
inner join v_StateNames sn on assc.StateType = sn.TopicType and sn.StateID=isnull(assc.StateID,0)
join v_R_System vrs on vrs.ResourceID = assc.ResourceID
where ds.CollectionID in
(Select CollectionID from v_fullCollectionMembership fcm where fcm.name = @ComputerName)
and vrs.Name0 = @ComputerName
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.