labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
FormatOsForPatching
Parameters
Name
Type
Mode
osName
varchar(255)
IN
Definition
BEGIN DECLARE originalOSName VARCHAR(255) DEFAULT ''; DECLARE formattedOSName VARCHAR(255) DEFAULT ''; DECLARE hyperV VARCHAR(10) DEFAULT ''; DECLARE R2 VARCHAR(5) DEFAULT ''; DECLARE x64 VARCHAR(5) DEFAULT ''; #Add a space to the end of the OS name to help with the matching SET originalOSName = CONCAT(osName, ' '); #####Check Hyper-V IF originalOSName LIKE '%Hyper-V%' THEN SET hyperV = ' Hyper-V'; END IF; #####Check R2SER IF originalOSName LIKE '% R2 %' THEN SET R2 = ' R2'; END IF; #####Check x64 IF originalOSName LIKE '% x64 %' THEN SET x64 = ' x64'; END IF; ############################## ATTENTION ##################################### ##### IF YOU MODIFY THIS PROCEDURE FOR THE LOVE OF GOD, PLEASE UPDATE ##### ##### NormalizeOperatingSystemForPatching() METHOD IN StringUtilities ##### ############################################################################## CASE #Exception Case for Windows 10 Enterprise 2016 WHEN (originalOSName LIKE '% 2016 %' AND originalOSName LIKE '% 10 %') THEN SET formattedOSName = CONCAT('Windows 10', x64); #Server OSs WHEN originalOSName LIKE '% 2019 %' THEN SET formattedOSName = CONCAT('Windows', hyperV, ' Server 2019', R2, x64); WHEN originalOSName LIKE '% 2016 %' THEN SET formattedOSName = CONCAT('Windows', hyperV, ' Server 2016', R2, x64); WHEN originalOSName LIKE '% 2012 %' THEN SET formattedOSName = CONCAT('Windows', hyperV, ' Server 2012', R2, x64); WHEN originalOSName LIKE '% 2011 %' THEN SET formattedOSName = CONCAT('Windows 2011', x64); WHEN originalOSName LIKE '% 2008 %' THEN SET formattedOSName = CONCAT('Windows', hyperV, ' Server 2008', R2, x64); #The next case will cover 'Server 2008 Hyper-V', as the OS returns the value without the '2008' WHEN originalOSName LIKE '%Hyper-V%' THEN SET formattedOSName = CONCAT('Windows Hyper-V Server', x64); WHEN originalOSName LIKE '% 2003 %' THEN SET formattedOSName = CONCAT('Windows Server 2003', x64); WHEN originalOSName LIKE '% Server %' THEN SET formattedOSName = CONCAT('Windows Server', x64); #Workstation OSs WHEN originalOSName LIKE '% 10 %' THEN SET formattedOSName = CONCAT('Windows 10', x64); WHEN originalOSName LIKE '%Microsoft Windows Technical Preview%' THEN SET formattedOSName = CONCAT('Windows 10', x64); WHEN originalOSName LIKE '% 8.1 %' THEN SET formattedOSName = CONCAT('Windows 8.1', x64); WHEN originalOSName LIKE '% 8 %' THEN SET formattedOSName = CONCAT('Windows 8', x64); WHEN originalOSName LIKE '%Windows Developer Preview%' THEN SET formattedOSName = CONCAT('Windows 8', x64); WHEN originalOSName LIKE '% 7 %' THEN SET formattedOSName = CONCAT('Windows 7', x64); WHEN originalOSName LIKE '%Vista%' THEN SET formattedOSName = CONCAT('Windows Vista', x64); WHEN originalOSName LIKE '% XP %' THEN SET formattedOSName = CONCAT('Windows XP', x64); WHEN originalOSName LIKE '% 2000 %' THEN SET formattedOSName = 'Windows 2000'; WHEN originalOSName LIKE '% NT %' THEN SET formattedOSName = 'Windows NT'; #New Computer WHEN originalOSName LIKE '%NewComputer%' THEN SET formattedOSName = ''; #If any string does not match these cases, just return the string ELSE SET formattedOSName = originalOSName; END CASE; RETURN formattedOSName; END