Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

SOLVED SQL Query for Installed Windows update compliance

vin418

Active Member
Messages
29
Reaction score
3
Points
3
HI All,

is there any SQL query for fetching the Windows update compliance report for all systems.
 
Hi Gokul,

I need query for Deployment Compliance and also Im looking for a seperate query through which i can pull up for installed updates also.
 
Hi ,
Attaching query and i have commented some of the line . You can modify according to your convince. You have to mention Deployment ID. If more deployment are present, you can replace the below last line with
Code:
 where a.AssignmentID in('DeplomentID1','DeplomentID1')


SQL:
select
vrs.name0 as machineName,
--vrs.AD_site_Name0 as ADSiteName,
--vrs.User_Name0 as UserName,
--a.Assignment_UniqueID as DeploymentID,
a.AssignmentName as DeploymentName,
sn.StateName as LastEnforcementState
--,
--assc.StateTime asStatusTime,
--assc.LastErrorCode as LastErrorCode
from v_CIAssignment a
join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID
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 a.AssignmentID = 'Mention Your DeploymentID'
 
Hi Grath,

I'm confused with which one is the correct report for the update compliance that i need to run to get it.
Here is a list of all of the built-in report and a short description of what each of them returns.

After reviewing the list just run them to see if they give you what you want.
 
Hi ,
Attaching query and i have commented some of the line . You can modify according to your convince. You have to mention Deployment ID. If more deployment are present, you can replace the below last line with
Code:
 where a.AssignmentID in('DeplomentID1','DeplomentID1')


SQL:
select
vrs.name0 as machineName,
--vrs.AD_site_Name0 as ADSiteName,
--vrs.User_Name0 as UserName,
--a.Assignment_UniqueID as DeploymentID,
a.AssignmentName as DeploymentName,
sn.StateName as LastEnforcementState
--,
--assc.StateTime asStatusTime,
--assc.LastErrorCode as LastErrorCode
from v_CIAssignment a
join v_AssignmentState_Combined assc on a.AssignmentID=assc.AssignmentID
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 a.AssignmentID = 'Mention Your DeploymentID'
Hi Gokul,

Thanks for the query and guidance.
It worked correctly.

Regards

Vineeth
 

Forum statistics

Threads
7,198
Messages
28,090
Members
18,367
Latest member
daybor
Back
Top