Lists SQL version and product key information.0true/ConfigMgr_ULB/{5C6358F2-4BB6-4a1b-A16E-8D96795D8602}Integrated6fe7a601-d088-4e03-b266-36dd4f559a6dCMSQLDatabase=Parameters!UserTokenSIDs.Value/* Get AdminID Dataset */
SELECT dbo.fn_rbac_GetAdminIDsfromUserSIDs (@UserTokenSIDs) AS UserSIDsUserSIDsSystem.StringCMSQLDatabase=Parameters!UserSIDs.ValueSELECT
CollectionID,
Name
FROM dbo.fn_rbac_Collection(@UserSIDs)
WHERE CollectionType = 2
ORDER BY
Name;trueCollectionIDSystem.StringNameSystem.StringCMSQLDatabase=Parameters!UserSIDs.Value=Parameters!CollectionID.Value=Join(Parameters!Filter.Value, ",")true/*
.SYNOPSIS
Gets SQL product info.
.DESCRIPTION
Gets SQL product info, id and product key.
.NOTES
Created by Ioan Popovici.
Requires the usp_PivotWithDynamicColumns stored procedure (SQL Support Functions).
Requires SQL Property and ProductID HWI extensions.
Part of a report should not be run separately.
.LINK
https://SCCM.Zone/SW-SQL-Server-Products
.LINK
https://SCCM.Zone/SQL-SupportFunctions
.LINK
https://SCCM.Zone/SW-SQL-Server-Products-CHANGELOG
.LINK
https://SCCM.Zone/SW-SQL-Server-Products-GIT
.LINK
https://SCCM.Zone/Issues
*/
/*##=============================================*/
/*## QUERY BODY */
/*##=============================================*/
/* #region QueryBody */
/* Test variable declaration !! Need to be commented for Production !! */
-- DECLARE @UserSIDs AS NVARCHAR(10) = 'Disabled';
-- DECLARE @CollectionID AS NVARCHAR(10) = 'SMS00001';
-- DECLARE @Filter AS NVARCHAR(20) = 'WID';
/* Variable declaration */
DECLARE @TableName AS NVARCHAR(MAX);
DECLARE @NonPivotedColumn AS NVARCHAR(MAX);
DECLARE @DynamicColumn AS NVARCHAR(MAX);
DECLARE @AggregationColumn AS NVARCHAR(MAX);
DECLARE @StaticColumnList AS NVARCHAR(MAX);
/* Perform cleanup */
IF OBJECT_ID('tempdb..#SQLProducts', 'U') IS NOT NULL
DROP TABLE #SQLProducts;
/* Create SQLProducts table */
CREATE TABLE #SQLProducts (
ResourceID NVARCHAR(25)
, SKUName NVARCHAR(100)
, [Version] NVARCHAR(25)
, FileVersion NVARCHAR(50)
, SPLevel NVARCHAR(2)
, IsClustered NVARCHAR(3)
, SQMReporting NVARCHAR(3)
)
/* Create SQLRelease table */
DECLARE @SQLRelease Table (FileVersion NVARCHAR(4), Release NVARCHAR(10))
/* Populate StaticColumnList */
SET @StaticColumnList = N'[SKUNAME],[VERSION],[FILEVERSION],[SPLEVEL],[CLUSTERED],[SQMREPORTING]'
/* Populate SQLRelease table */
INSERT INTO @SQLRelease (FileVersion, Release)
VALUES
('2019', '2019')
, ('2017', '2017')
, ('2016', '2017')
, ('2015', '2016')
, ('2014', '2014')
, ('2013', '2014')
, ('2012', '2012')
, ('2011', '2012')
, ('2010', '2012')
, ('2009', '2008 R2')
, ('2007', '2008')
, ('2005', '2005')
, ('2000', '2000')
, ('', 'Unknown')
/* Get SQL 2019 data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2019_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL 2017 data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2017_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL 2016 data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2016_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL 2014 data data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2014_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL 2012 data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2012_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL 2008 data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_2008_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Get SQL Legacy data */
INSERT INTO #SQLProducts
EXECUTE dbo.usp_PivotWithDynamicColumns
@TableName = N'dbo.v_GS_EXT_SQL_Legacy_Property0'
, @NonPivotedColumn = N'ResourceID'
, @DynamicColumn = N'PropertyName0'
, @AggregationColumn = N'ISNULL(PropertyStrValue0, PropertyNumValue0)'
, @StaticColumnList = @StaticColumnList;
/* Aggregate result data */
WITH SQLProducts_CTE (Release, EditionGroup, [Edition], [Version], ServicePack, CUVersion, IsClustered, Bitness, CEIPReporting, ProductKey, Device, DomainOrWorkgroup, OperatingSystem, IsVirtualMachine, CPUs, PhysicalCores, LogicalCores)
AS (
SELECT
Release = (
'SQL ' + (SELECT Release FROM @SQLRelease WHERE FileVersion = LEFT(SQLProducts.FileVersion, 4))
)
, EditionGroup = (
CASE
WHEN SQLProducts.SKUName LIKE '%enter%' THEN 'Enterprise'
WHEN SQLProducts.SKUName LIKE '%stand%' THEN 'Standard'
WHEN SQLProducts.SKUName LIKE '%expre%' THEN 'Express'
WHEN SQLProducts.SKUName LIKE '%devel%' THEN 'Developer'
WHEN SQLProducts.SKUName LIKE '%windo%' THEN 'WID'
WHEN SQLProducts.SKUName IS NULL THEN 'N/A'
ELSE 'Legacy'
END
)
, [Edition] = ISNULL(NULLIF(SQLProducts.SKUName, ''), 'N/A')
, [Version] = SQLProducts.[Version]
, ServicePack = SQLProducts.SPLevel
, CUVersion = SQLProducts.FileVersion
, IsClustered = (
CASE SQLProducts.IsClustered
WHEN 0 THEN 'No'
WHEN 1 THEN 'Yes'
ELSE NULL
END
)
, Bitness = (
CASE
WHEN SQLProducts.SKUName LIKE '%64%' THEN 'x64'
WHEN SQLProducts.SKUName IS NOT NULL THEN 'x86'
ELSE 'N/A'
END
)
, CEIPReporting = (
CASE SQLProducts.SQMReporting
WHEN 0 THEN 'No'
WHEN 1 THEN 'Yes'
ELSE NULL
END
)
, ProductKey = ISNULL(SQLProductID.DigitalProductID0, 'N/A')
, Device = Devices.[Name]
, DomainOrWorkgroup = ISNULL(Systems.Full_Domain_Name0, Systems.Resource_Domain_Or_Workgr0)
, OperatingSystem = (
/* Get OS caption by version */
CASE
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 5.%' THEN 'Windows XP'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 6.0%' THEN 'Windows Vista'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 6.1%' THEN 'Windows 7'
WHEN Systems.Operating_System_Name_And0 LIKE 'Windows_7 Entreprise 6.1' THEN 'Windows 7'
WHEN Systems.Operating_System_Name_And0 = 'Windows Embedded Standard 6.1' THEN 'Windows 7'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 6.2%' THEN 'Windows 8'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 6.3%' THEN 'Windows 8.1'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 10%' THEN 'Windows 10'
WHEN Systems.Operating_System_Name_And0 LIKE '%Workstation 10%' THEN 'Windows 10'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 5.%' THEN 'Windows Server 2003'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 6.0%' THEN 'Windows Server 2008'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 6.1%' THEN 'Windows Server 2008 R2'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 6.2%' THEN 'Windows Server 2012'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 6.3%' THEN 'Windows Server 2012 R2'
WHEN Systems.Operating_System_Name_And0 LIKE '%Server 10%' THEN (
CASE
WHEN CAST(REPLACE(Build01, '.', '') AS INTEGER) > 10017763 THEN 'Windows Server 2019'
ELSE 'Windows Server 2016'
END
)
ELSE Systems.Operating_System_Name_And0
END
)
, IsVirtualMachine = (
CASE Devices.IsVirtualMachine
WHEN 0 THEN 'No'
WHEN 1 THEN 'Yes'
ELSE NULL
END
)
, CPUs = COUNT(Processor.ResourceID)
, PhysicalCores = SUM(Processor.NumberOfCores0)
, LogicalCores = SUM(Processor.NumberOfLogicalProcessors0)
FROM fn_rbac_FullCollectionMembership(@UserSIDs) AS CollectionMembers
JOIN v_R_System AS Systems ON Systems.ResourceID = CollectionMembers.ResourceID
JOIN v_CombinedDeviceResources AS Devices ON Devices.MachineID = CollectionMembers.ResourceID
JOIN v_GS_PROCESSOR AS Processor ON Processor.ResourceID = CollectionMembers.ResourceID
JOIN #SQLProducts AS SQLProducts ON SQLProducts.ResourceID = CollectionMembers.ResourceID
LEFT JOIN dbo.v_GS_EXT_SQL_PRODUCTID0 AS SQLProductID ON SQLProductID.ResourceID = SQLProducts.ResourceID
AND SQLProductID.Release0 = (
SELECT Release FROM @SQLRelease WHERE FileVersion = LEFT(SQLProducts.FileVersion, 4)
)
AND SQLProductID.ProductID0 IS NOT NULL
WHERE CollectionMembers.CollectionID = @CollectionID
GROUP BY
SQLProducts.FileVersion
, SQLProducts.SKUName
, SQLProducts.[Version]
, SQLProducts.SPLevel
, SQLProducts.IsClustered
, SQLProducts.SQMReporting
, SQLProductID.DigitalProductID0
, Devices.[Name]
, Systems.Full_Domain_Name0
, Systems.Resource_Domain_Or_Workgr0
, Systems.Operating_System_Name_and0
, Systems.Build01
, Devices.IsVirtualMachine
, Processor.NumberOfCores0
, Processor.NumberOfLogicalProcessors0
)
/* Filter results */
SELECT
Release
, EditionGroup
, [Edition]
, [Version]
, ServicePack
, CUVersion
, IsClustered
, Bitness
, CEIPReporting
, ProductKey
, Device
, DomainOrWorkgroup
, OperatingSystem
, IsVirtualMachine
, CPUs
, PhysicalCores
, LogicalCores
FROM SQLProducts_CTE
WHERE EditionGroup NOT IN (@Filter)
/* Perform cleanup */
IF OBJECT_ID('tempdb..#SQLProducts', 'U') IS NOT NULL
DROP TABLE #SQLProducts;
/* #endregion */
/*##=============================================*/
/*## END QUERY BODY */
/*##=============================================*/trueReleaseSystem.StringEditionGroupSystem.StringEditionSystem.StringVersionSystem.StringServicePackSystem.StringCUVersionSystem.StringIsClusteredSystem.StringBitnessSystem.StringCEIPReportingSystem.StringProductKeySystem.StringDeviceSystem.StringDomainOrWorkgroupSystem.StringOperatingSystemSystem.StringIsVirtualMachineSystem.StringCPUsSystem.Int32PhysicalCoresSystem.Int32LogicalCoresSystem.Int321.47018in8.35556in0.4intruetrue=SrsResources.Localization.GetString("Description", User!Language)2pt2pt2pt2pttruetrueLists SQL version and product key information.Report_DescriptionLabel5pt2pt2pt2ptSQLProductInfo0.03194in0.127cm0.4in9.82574in0.44815in0.04887in0in20.67956in11.5pt1.5pt1.5pt1.5pt1.5pt3.71708cm4.02104cm2.15604cm2.23542cm2.60583cm2.35417cm1.83854cm0.6cmtrue=Fields!DomainOrWorkgroup.Valuetrue=SrsResources.Localization.GetString("Domain or Workgroup", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Fields!OperatingSystem.Valuetrue=SrsResources.Localization.GetString("OperatingSystem", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Fields!IsVirtualMachine.Valuetrue=SrsResources.Localization.GetString("VM", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Fields!CPUs.Valuetrue=SrsResources.Localization.GetString("CPUs", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Fields!PhysicalCores.Valuetrue=SrsResources.Localization.GetString("Physical Cores", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Fields!LogicalCores.Valuetrue=SrsResources.Localization.GetString("Logical Cores", User!Language)LightGreyMiddle2pt2pt2pt2pttrue=Sum(CountDistinct(Fields!Device.Value))Releasetrue=SrsResources.Localization.GetString("Total", User!Language)LightGreyMiddle2pt2pt2pt2pt0.6cmtruetrueTextbox230Middle2pt2pt2pt2pttruetrueTextbox231Middle2pt2pt2pt2pttruetrueTextbox232Middle2pt2pt2pt2pttruetrueTextbox233Middle2pt2pt2pt2pttruetrueTextbox234Middle2pt2pt2pt2pttruetrueTextbox235Middle2pt2pt2pt2pttruetrueTextbox279Middle2pt2pt2pt2pt0.6cmtruetrueTextbox162WhiteSmokeMiddle2pt2pt2pt2pttruetrueTextbox163WhiteSmokeMiddle2pt2pt2pt2pttruetrueTextbox164WhiteSmokeMiddle2pt2pt2pt2pttruetrueTextbox165WhiteSmokeMiddle2pt2pt2pt2pttruetrueTextbox166WhiteSmokeMiddle2pt2pt2pt2pttruetrueTextbox167WhiteSmokeMiddle2pt2pt2pt2pttruetrue=CountDistinct(Fields!Device.Value)WhiteSmokeMiddle2pt2pt2pt2pt0.6cmtruetrueTextbox301Middle2pt2pt2pt2pttruetrueTextbox302Middle2pt2pt2pt2pttruetrueTextbox303Middle2pt2pt2pt2pttruetrueTextbox304Middle2pt2pt2pt2pttruetrueTextbox305Middle2pt2pt2pt2pttruetrueTextbox306Middle2pt2pt2pt2pttruetrueTextbox10Middle2pt2pt2pt2pt0.6cmtruetrue=Fields!DomainOrWorkgroup.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=Fields!OperatingSystem.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=Fields!IsVirtualMachine.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=Fields!CPUs.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=Fields!PhysicalCores.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=Fields!LogicalCores.ValueWhiteSmokeMiddle2pt2pt2pt2pttruetrue=CountDistinct(Fields!Device.Value)WhiteSmokeMiddle2pt2pt2pt2pt0.6cmtruetrueTextbox80LightGreyMiddle2pt2pt2pt2pttruetrueTextbox83LightGreyMiddle2pt2pt2pt2pttruetrueTextbox86LightGreyMiddle2pt2pt2pt2pttruetrueTextbox89LightGreyMiddle2pt2pt2pt2pttruetrueTextbox92LightGreyMiddle2pt2pt2pt2pttruetrueTextbox284LightGreyMiddle2pt2pt2pt2pttruetrue=CountDistinct(Fields!Device.Value)LightGreyMiddle2pt2pt2pt2pt2.46025cmtrue=Fields!Release.ValueReleasetrue=SrsResources.Localization.GetString("Release", User!Language)LightGreyMiddle2pt2pt2pt2pt2.63229cmtrue=Fields!EditionGroup.ValueEditionGrouptrue=SrsResources.Localization.GetString("Edition Group", User!Language)LightGreyMiddle2pt2pt2pt2pt4.48437cmtrue=Fields!Edition.ValueEditiontrue=SrsResources.Localization.GetString("Edition", User!Language)LightGreyMiddle2pt2pt2pt2pt2.71167cmtrue=Fields!Version.ValueEditiontrue=SrsResources.Localization.GetString("Version", User!Language)LightGreyMiddle2pt2pt2pt2pt2.44708cmtrue=Fields!ServicePack.ValueEditiontrue=SrsResources.Localization.GetString("SP", User!Language)LightGreyMiddle2pt2pt2pt2pt2.5cmtrue=Fields!CUVersion.ValueEditiontrue=SrsResources.Localization.GetString("CU", User!Language)LightGreyMiddle2pt2pt2pt2pt2.38063cmtrue=Fields!IsClustered.ValueEditiontrue=SrsResources.Localization.GetString("Clustered", User!Language)LightGreyMiddle2pt2pt2pt2pt2.28833cmtrue=Fields!Bitness.ValueEditiontrue=SrsResources.Localization.GetString("Bitness", User!Language)LightGreyMiddle2pt2pt2pt2pt2.5cmtrue=Fields!CEIPReporting.ValueEditiontrue=SrsResources.Localization.GetString("CEIP", User!Language)LightGreyMiddle2pt2pt2pt2pt5.82021cmtruetrue=SrsResources.Localization.GetString("Product Key", User!Language)LightGreyMiddle2pt2pt2pt2pt3.37313cmtrue=Fields!Device.Valuetrue=SrsResources.Localization.GetString("Device", User!Language)LightGreyMiddle2pt2pt2pt2pt=Fields!Release.Value=Fields!Release.Value=Fields!EditionGroup.Value=Fields!Edition.Value=Fields!Version.Value=Fields!ServicePack.Value=Fields!CUVersion.Value=Fields!IsClustered.Value=Fields!Bitness.Value=Fields!CEIPReporting.Value=Fields!ProductKey.Value=Fields!Device.Value=Fields!DomainOrWorkgroup.Value=Fields!OperatingSystem.Value=Fields!IsVirtualMachine.Value=Fields!CPUs.Value=Fields!PhysicalCores.Value=Fields!LogicalCores.Value2.46025cmtruetrue=Fields!Release.ValueMiddle2pt2pt2pt2pt2.63229cmtruetrueTextbox222Middle2pt2pt2pt2pt4.48437cmtruetrueTextbox223Middle2pt2pt2pt2pt2.71167cmtruetrueTextbox224Middle2pt2pt2pt2pt2.44708cmtruetrueTextbox225Middle2pt2pt2pt2pt2.5cmtruetrueTextbox226Middle2pt2pt2pt2pt2.38063cmtruetrueTextbox273Middle2pt2pt2pt2pt2.28833cmtruetrueTextbox227Middle2pt2pt2pt2pt2.5cmtruetrueTextbox2Middle2pt2pt2pt2pt5.82021cmtruetrueTextbox228Middle2pt2pt2pt2pt3.37313cmtruetrueTextbox229Middle2pt2pt2pt2ptAfter=Fields!EditionGroup.Value=Fields!EditionGroup.Value2.63229cmtruetrue=Fields!EditionGroup.ValueWhiteSmokeMiddle2pt2pt2pt2pt4.48437cmtruetrueTextbox155WhiteSmokeMiddle2pt2pt2pt2pt2.71167cmtruetrueTextbox156WhiteSmokeMiddle2pt2pt2pt2pt2.44708cmtruetrueTextbox157WhiteSmokeMiddle2pt2pt2pt2pt2.5cmtruetrueTextbox158WhiteSmokeMiddle2pt2pt2pt2pt2.38063cmtruetrueTextbox274WhiteSmokeMiddle2pt2pt2pt2pt2.28833cmtruetrueTextbox159WhiteSmokeMiddle2pt2pt2pt2pt2.5cmtruetrueTextbox3WhiteSmokeMiddle2pt2pt2pt2pt5.82021cmtruetrueTextbox160WhiteSmokeMiddle2pt2pt2pt2pt3.37313cmtruetrueTextbox169WhiteSmokeMiddle2pt2pt2pt2ptAfter=Fields!Edition.Value=Fields!Edition.Value4.48437cmtruetrue=Fields!Edition.ValueMiddle2pt2pt2pt2pt=Fields!Version.Value=Fields!Version.Value2.71167cmtruetrue=Fields!Version.ValueMiddle2pt2pt2pt2pt=Fields!ServicePack.Value=Fields!ServicePack.Value2.44708cmtruetrue=Fields!ServicePack.ValueMiddle2pt2pt2pt2pt=Fields!CUVersion.Value=Fields!CUVersion.Value2.5cmtruetrue=Fields!CUVersion.ValueMiddle2pt2pt2pt2pt2.38063cmtruetrue=Fields!IsClustered.ValueMiddle2pt2pt2pt2pt=Fields!Bitness.Value=Fields!Bitness.Value2.28833cmtruetrue=Fields!Bitness.ValueMiddle2pt2pt2pt2pt=Fields!CEIPReporting.Value=Fields!CEIPReporting.Value2.5cmtruetrue=Fields!CEIPReporting.ValueMiddle2pt2pt2pt2pt5.82021cmtruetrueProductKeyMiddle2pt2pt2pt2pt3.37313cmtruetrueTextbox300Middle2pt2pt2pt2pt=Fields!ProductKey.Value5.82021cmtruetrue=IIF(Fields!EditionGroup.Value <> "Express", IIF(Parameters!HideProductKey.Value = false, Code.GetSQLProductKey(Split(Replace(Fields!ProductKey.Value, " ",""), ","), Left(Fields!Version.Value, 2)), "Hidden"), Nothing)WhiteSmokeMiddle2pt2pt2pt2pt3.37313cmtruetrue=Fields!Device.ValueWhiteSmokeMiddle2pt2pt2pt2ptTV_CEIPReportingTV_EditionGroupTV_Release2.46025cmtruetrueTotalLightGreyMiddle2pt2pt2pt2pt2.63229cmtruetrueTextbox104LightGreyMiddle2pt2pt2pt2pt4.48437cmtruetrueTextbox107LightGreyMiddle2pt2pt2pt2pt2.71167cmtruetrueTextbox49LightGreyMiddle2pt2pt2pt2pt2.44708cmtruetrueTextbox113LightGreyMiddle2pt2pt2pt2pt2.5cmtruetrueTextbox116LightGreyMiddle2pt2pt2pt2pt2.38063cmtruetrueTextbox277LightGreyMiddle2pt2pt2pt2pt2.28833cmtruetrueTextbox119LightGreyMiddle2pt2pt2pt2pt2.5cmtruetrueTextbox6LightGreyMiddle2pt2pt2pt2pt5.82021cmtruetrueTextbox122LightGreyMiddle2pt2pt2pt2pt3.37313cmtruetrueTextbox172LightGreyMiddle2pt2pt2pt2ptSQLProductInfo1.2997cm0.12413cm3.6cm52.52608cm24.8997cm52.80896cm2.49515cmtruetruetruetrue=SrsResources.Localization.GetString(Globals!ReportName, User!Language)1.59698cm0.127cm0.89817cm24.95739cmMiddle2pt2pt2pt2pt0.60444in0.05in0in20.67843in10.75pt0.75pt0.75pt0.75pt0.75pt1.25148cmtruetruetruetrue="Page: " + Globals!PageNumber.ToString() + "of " + Globals!TotalPages.ToString()0.38806cm0.12413cm0.63492cm2.79292cm0.06944in0.04887in0in20.67956in11.5pt1.5pt1.5pt1.5pt1.5pt21cm29.7cm2.54cm2.54cm2.54cm2.54cm1.27cmString=SrsResources.UserIdentity.GetUserSIDs(User!UserID)UserTokenSIDstrue7b5f538e-1262-4705-a7df-7d4d398a195e/Report Parts/UserTokenSIDs2015-02-25T11:56:20.9330000+02:00StringAdminIDUserSIDstrue2c7b7dc1-c255-43f4-b6eb-9836f5be644e/Report Parts/UserSIDs2015-02-25T11:56:21.3870000+02:00Stringtrue=Globals!ReportNametruetrueStringCollection NameCollectionInfoCollectionIDNameStringN/AtrueFilter by edition groups (multiple selection)N/AEnterpriseStandardExpressDeveloperLegacyWIDtrueBooleanfalseHide Product Keytruefalse4400UserTokenSIDs10UserSIDs20ReportName11CollectionID21Filter31HideProductKey'.SYNOPSIS
' Gets SQL product key.
'.DESCRIPTION
' Gets SQL product key from a binary string array.
'.PARAMETER astrBinaryKey
' Specifies the obfuscated key.
'.PARAMETER intVersion
' Specifies the SQL version.
'.EXAMPLE
' Code.GetSQLProductKey(Fields!SomeField.Value, 12) (SSRS)
'.EXAMPLE
' GetSQLProductKey({1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0}, 12) (VB.Net)
'.NOTES
' Created by Ioan Popovici.
' Credit to Jakob Bindslet and Chrissy LeMaire.
' I only translated the script in Visual Basic, nothing else.
'.LINK
' http://mspowershell.blogspot.com/2010/11/sql-server-product-key.html (Jakob Bindslet)
' https://gallery.technet.microsoft.com/scriptcenter/Get-SQL-Server-Product-4b5bf4f8 (Chrissy LeMaire)
'.LINK
' https://SCCM.Zone
'.LINK
' https://SCCM.Zone/Issues
'
'/*##=============================================*/
'/*## SCRIPT BODY */
'/*##=============================================*/
'/* #region FunctionBody */
Function GetSQLProductKey(ByVal astrBinaryKey As String(), ByVal intVersion As Integer) As String
Dim achrKeyChars As Char() = {"B", "C", "D", "F", "G", "H", "J", "K", "M", "P", "Q", "R", "T", "V", "W", "X", "Y", "2", "3", "4", "6", "7", "8", "9"}
Dim strSQLProductKey As String
Dim iastrBinaryKey As Long
Dim iachrKeyChars As Long
Dim iastrBinaryKeyOuterLoop As Long
Dim iastrBinaryKeyInnerLoop As Long
Try
If (intVersion >= 11) Then
iastrBinaryKey = 0
Else
iastrBinaryKey = 52
End If
For iastrBinaryKeyOuterLoop = 24 To 0 Step -1
iachrKeyChars = 0
For iastrBinaryKeyInnerLoop = 14 To 0 Step -1
iachrKeyChars = iachrKeyChars * 256 Xor astrBinaryKey(iastrBinaryKeyInnerLoop + iastrBinaryKey)
astrBinaryKey(iastrBinaryKeyInnerLoop + iastrBinaryKey) = Math.Truncate(iachrKeyChars / 24)
iachrKeyChars = iachrKeyChars Mod 24
Next iastrBinaryKeyInnerLoop
strSQLProductKey = achrKeyChars(iachrKeyChars) + strSQLProductKey
If (iastrBinaryKeyOuterLoop Mod 5) = 0 And iastrBinaryKeyOuterLoop <> 0 Then
strSQLProductKey = "-" + strSQLProductKey
End If
Next iastrBinaryKeyOuterLoop
Catch
strSQLProductKey = "Cannot decode product key."
End Try
GetSQLProductKey = strSQLProductKey
End Function
'/* #endregion */
'/*##=============================================*/
'/*## END SCRIPT BODY */
'/*##=============================================*/SrsResources, Culture=neutralCmhttp://ulb-cm-sql-01a/ReportServer6fbd236a-d836-4950-8788-14b828deb616