Skip to content

Instantly share code, notes, and snippets.

@Laim
Last active June 4, 2021 15:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Laim/ecd710283e897d6967ba77fb8883e2b3 to your computer and use it in GitHub Desktop.
Mass hide Unassigned Software in Snow License Manager to prevent SMACC lag
/*
Author: Laim McKenzie
Website: https://laim.scot
Version: 1.0
You can view the Hidden Software count using this script
SELECT COUNT(*) FROM SnowLicenseManager.dbo.tblSoftware WHERE IsHidden = 1
*/
BEGIN
SET NOCOUNT ON
DECLARE @SoftwareChecksumLCL bigint
DECLARE @SoftwareHidden int
SET @SoftwareHidden = 0
DECLARE Client_Cursor CURSOR
FOR
SELECT SoftwareCheckSum
FROM [SnowLicenseManager].[dbo].[tblSoftwareCIDUnassigned]
WHERE SoftwareCheckSum NOT IN (SELECT SoftwareCheckSum FROM SnowLicenseManager.dbo.tblSoftware WHERE IsHidden = 1)
OPEN Client_Cursor
FETCH NEXT FROM Client_Cursor INTO @SoftwareChecksumLCL
WHILE (@@FETCH_STATUS <> -1)
BEGIN
IF (@@FETCH_STATUS <> -2)
BEGIN
-- PRINT @SoftwareChecksumLCL
EXEC [SnowLicenseManager].[dbo].[SoftwareHiddenSet]
@SoftwareChecksum = @SoftwareChecksumLCL,
@IsHidden=1
SET @SoftwareHidden = @SoftwareHidden + 1
END
FETCH NEXT FROM Client_Cursor INTO @SoftwareChecksumLCL
END
CLOSE Client_Cursor
DEALLOCATE Client_Cursor
PRINT (CONVERT(varchar,@SoftwareHidden) + ' unassigned softwares hidden [maybe?]')
SET NOCOUNT OFF
END
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment