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!

PENDING sql query for missing maintenance windows

  • Thread starter Thread starter dj3094
  • Start date Start date
  • Replies Replies 3
  • Views Views 2K

dj3094

Well-Known Member
Messages
241
Reaction score
7
Points
18
Hello experts,
Is there any sql query to get the machines that has no maintenance windows?
Thanks in advance
 
I came up with this but its getting error execution timeout expired
SELECT dbo.v_R_System.Name0, dbo.v_R_System.AD_Site_Name0, dbo.v_R_System.Client0, dbo.v_R_System.Operating_System_Name_and0, dbo.v_FullCollectionMembership.CollectionID
FROM dbo.v_FullCollectionMembership INNER JOIN
dbo.v_ServiceWindow ON dbo.v_FullCollectionMembership.CollectionID = dbo.v_ServiceWindow.CollectionID CROSS JOIN
dbo.v_R_System
WHERE (dbo.v_R_System.Client0 = 1) AND (NOT (dbo.v_R_System.Name0 IN
(SELECT SYS.Name0
FROM dbo.v_ServiceWindow AS SW INNER JOIN
dbo.v_FullCollectionMembership AS FCM ON SW.CollectionID = FCM.CollectionID INNER JOIN
dbo.v_R_System AS SYS ON FCM.ResourceID = SYS.ResourceID)))
 
I came up with this but its getting error execution timeout expired
SELECT dbo.v_R_System.Name0, dbo.v_R_System.AD_Site_Name0, dbo.v_R_System.Client0, dbo.v_R_System.Operating_System_Name_and0, dbo.v_FullCollectionMembership.CollectionID
FROM dbo.v_FullCollectionMembership INNER JOIN
dbo.v_ServiceWindow ON dbo.v_FullCollectionMembership.CollectionID = dbo.v_ServiceWindow.CollectionID CROSS JOIN
dbo.v_R_System
WHERE (dbo.v_R_System.Client0 = 1) AND (NOT (dbo.v_R_System.Name0 IN
(SELECT SYS.Name0
FROM dbo.v_ServiceWindow AS SW INNER JOIN
dbo.v_FullCollectionMembership AS FCM ON SW.CollectionID = FCM.CollectionID INNER JOIN
dbo.v_R_System AS SYS ON FCM.ResourceID = SYS.ResourceID)))

Your error is telling you that you have too big of a dataset because of your cross joins. Use an inner or outer join on resouceid.
 
Back
Top