Skip to content

Instantly share code, notes, and snippets.

@DarkAllien
Last active January 16, 2019 09:36
Show Gist options
  • Select an option

  • Save DarkAllien/fb56df9f76affe45364a1729963bf295 to your computer and use it in GitHub Desktop.

Select an option

Save DarkAllien/fb56df9f76affe45364a1729963bf295 to your computer and use it in GitHub Desktop.
BEGIN
--replace all CM_XXX with your SCCM DB name
DELETE FROM [grafana].[dbo].[Servers]
WHERE [filter] = 'Servers.Patching.Available.Last';
DECLARE @UserSIDs VARCHAR(16);
SELECT @UserSIDs = 'disabled';
-- servers collection ID excluded from updates
DECLARE @CollID VARCHAR(8)= 'XXX0012B'; -- srv patching available
DECLARE @AuthListLocalID AS INT;
SELECT @AuthListLocalID = [CI_ID]
FROM [CM_XXX].[dbo].[v_AuthListInfo];
-- Adjust this Software Update Group Name filter to fit your Naming Convention
-- (looking for SUG deployed as required in the environment to see the deviation)
DECLARE @SUG TABLE([id] INT);
INSERT INTO @SUG
SELECT TOP 1 [CI_ID]
FROM [CM_XXX].[dbo].[v_AuthListInfo]
WHERE([title] LIKE '%serv%req%month%'
AND [title] NOT LIKE '%office%'
AND [title] NOT LIKE '%pilot%'
AND [title] NOT LIKE '%TMP%')
ORDER BY [datecreated] DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment