Finding Maintenance Window Collections

For workstations:

— List Computers with Maintenance Window

SELECT col.Name AS CollectionName,
    sw.Name AS [MW Name], 
    sw.Description, 
    sw.StartTime, 
    sw.Duration AS 'Duration Minutes',
    sw.IsEnabled AS 'MW Enabled', 
    sys.Name0 AS WorkstationName, 
    sys.Operating_System_Name_and0 AS OperatingSystem
FROM  dbo.v_ServiceWindow AS sw 
INNER JOIN  dbo.v_FullCollectionMembership AS fcm ON sw.CollectionID = fcm.CollectionID 
INNER JOIN  dbo.v_Collection AS col ON sw.CollectionID = col.CollectionID 
INNER JOIN  dbo.v_R_System sys ON fcm.ResourceID = sys.ResourceID 
WHERE  (sys.Operating_System_Name_and0 LIKE '%workstation%') 
ORDER BY col.Name, [MW Name], sys.Name0

 

For Servers:

SELECT col.Name AS CollectionName,
    sw.Name AS [MW Name], 
    sw.Description, 
    sw.StartTime, 
    sw.Duration AS 'Duration Minutes',
    sw.IsEnabled AS 'MW Enabled', 
    sys.Name0 AS ServerName, 
    sys.Operating_System_Name_and0 AS OperatingSystem
FROM  dbo.v_ServiceWindow AS sw 
INNER JOIN  dbo.v_FullCollectionMembership AS fcm ON sw.CollectionID = fcm.CollectionID 
INNER JOIN  dbo.v_Collection AS col ON sw.CollectionID = col.CollectionID 
INNER JOIN  dbo.v_R_System sys ON fcm.ResourceID = sys.ResourceID 
WHERE  (sys.Operating_System_Name_and0 LIKE '%server%') 
ORDER BY col.Name, [MW Name], sys.Name0

Advertisements
This entry was posted in ConfigMgr, SQL Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s