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.

Revisions

  1. DarkAllien revised this gist Jan 16, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sql_jobs_updates.sql
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    DECLARE @UserSIDs VARCHAR(16);
    SELECT @UserSIDs = 'disabled';

    -- Master servers collection ID with updates deployed as required
    -- Master/Top servers collection ID with updates deployed as required
    DECLARE @CollID VARCHAR(8)= 'XXX00111';
    DELETE FROM [grafana].[dbo].[Servers]
    WHERE [filter] = 'Servers.Patching.Required.Overall';
  2. DarkAllien revised this gist Jan 16, 2019. 1 changed file with 10 additions and 12 deletions.
    22 changes: 10 additions & 12 deletions sql_jobs_updates.sql
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,23 @@
    BEGIN

    --replace all CM_XXX with your SCCM DB name
    DELETE FROM [grafana].[dbo].[Servers]
    WHERE [filter] = 'Servers.Patching.Available.Last';
    --replace all CM_XXX with your SCCM DB name
    DECLARE @UserSIDs VARCHAR(16);
    SELECT @UserSIDs = 'disabled';

    -- servers collection ID excluded from updates
    DECLARE @CollID VARCHAR(8)= 'XXX0012B'; -- srv patching available

    -- Master servers collection ID with updates deployed as required
    DECLARE @CollID VARCHAR(8)= 'XXX00111';
    DELETE FROM [grafana].[dbo].[Servers]
    WHERE [filter] = 'Servers.Patching.Required.Overall';
    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)

    -- Adjust this Software Update Group Name filter to fit your Naming Convention
    DECLARE @SUG TABLE([id] INT);
    INSERT INTO @SUG
    SELECT TOP 1 [CI_ID]
    SELECT [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;
    OR [title] LIKE '%baseline';
  3. DarkAllien created this gist Jan 16, 2019.
    25 changes: 25 additions & 0 deletions sql_jobs_updates.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    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;