Advertisement
Guest User

slmgr.vbs

a guest
Jan 25th, 2017
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 120.94 KB | None | 0 0
  1. '
  2. ' Copyright (c) Microsoft Corporation. All rights reserved.
  3. '
  4. ' Windows Software Licensing Management Tool.
  5. '
  6. ' Script Name: slmgr.vbs
  7. '
  8.  
  9. Option Explicit
  10.  
  11. Dim g_objWMIService, g_strComputer, g_strUserName, g_strPassword
  12. g_strComputer = "."
  13. Dim g_serviceConnected
  14. g_serviceConnected = False
  15.  
  16. dim g_EchoString
  17. g_EchoString = ""
  18.  
  19. dim g_objRegistry
  20.  
  21. Dim g_resourceDictionary, g_resourcesLoaded
  22. Set g_resourceDictionary = CreateObject("Scripting.Dictionary")
  23. g_resourcesLoaded = False
  24.  
  25. Dim g_DeterminedDisplayFlags
  26. g_DeterminedDisplayFlags = False
  27.  
  28. Dim g_ShowKmsInfo
  29. Dim g_ShowKmsClientInfo
  30. Dim g_ShowTkaClientInfo
  31. Dim g_ShowTBLInfo
  32. Dim g_ShowPhoneInfo
  33.  
  34. g_ShowKmsInfo = False
  35. g_ShowKmsClientInfo = false
  36. g_ShowTBLInfo = False
  37. g_ShowPhoneInfo = False
  38.  
  39. ' Messages
  40.  
  41. 'Global options
  42. private const L_optInstallProductKey = "ipk"
  43. private const L_optInstallProductKeyUsage = "Install product key (replaces existing key)"
  44.  
  45. private const L_optUninstallProductKey = "upk"
  46. private const L_optUninstallProductKeyUsage = "Uninstall product key"
  47.  
  48. private const L_optActivateProduct = "ato"
  49. private const L_optActivateProductUsage = "Activate Windows"
  50.  
  51. private const L_optDisplayInformation = "dli"
  52. private const L_optDisplayInformationUsage = "Display license information (default: current license)"
  53.  
  54. private const L_optDisplayInformationVerbose = "dlv"
  55. private const L_optDisplayInformationUsageVerbose = "Display detailed license information (default: current license)"
  56.  
  57. private const L_optExpirationDatime = "xpr"
  58. private const L_optExpirationDatimeUsage = "Expiration date for current license state"
  59.  
  60. 'Advanced options
  61. private const L_optClearPKeyFromRegistry = "cpky"
  62. private const L_optClearPKeyFromRegistryUsage = "Clear product key from the registry (prevents disclosure attacks)"
  63.  
  64. private const L_optInstallLicense = "ilc"
  65. private const L_optInstallLicenseUsage = "Install license"
  66.  
  67. private const L_optReinstallLicenses = "rilc"
  68. private const L_optReinstallLicensesUsage = "Re-install system license files"
  69.  
  70. private const L_optDisplayIID = "dti"
  71. private const L_optDisplayIIDUsage = "Display Installation ID for offline activation"
  72.  
  73. private const L_optPhoneActivateProduct = "atp"
  74. private const L_optPhoneActivateProductUsage = "Activate product with user-provided Confirmation ID"
  75.  
  76. private const L_optReArmWindows = "rearm"
  77. private const L_optReArmWindowsUsage = "Reset the licensing status of the machine"
  78.  
  79. 'KMS options
  80.  
  81. private const L_optSetKmsName = "skms"
  82. private const L_optSetKmsNameUsage = "Set the name and/or the port for the KMS computer this machine will use. IPv6 address must be specified in the format [hostname]:port"
  83.  
  84. private const L_optClearKmsName = "ckms"
  85. private const L_optClearKmsNameUsage = "Clear name of KMS computer used (sets the port to the default)"
  86.  
  87. private const L_optSetKmsHostCaching = "skhc"
  88. private const L_optSetKmsHostCachingUsage = "Enable KMS host caching"
  89.  
  90. private const L_optClearKmsHostCaching = "ckhc"
  91. private const L_optClearKmsHostCachingUsage = "Disable KMS host caching"
  92.  
  93. private const L_optSetActivationInterval = "sai"
  94. private const L_optSetActivationIntervalUsage = "Set interval (minutes) for unactivated clients to attempt KMS connection. The activation interval must be between 15 minutes (min) and 30 days (max) although the default (2 hours) is recommended."
  95.  
  96. private const L_optSetRenewalInterval = "sri"
  97. private const L_optSetRenewalIntervalUsage = "Set renewal interval (minutes) for activated clients to attempt KMS connection. The renewal interval must be between 15 minutes (min) and 30 days (max) although the default (7 days) is recommended."
  98.  
  99. private const L_optSetKmsListenPort = "sprt"
  100. private const L_optSetKmsListenPortUsage = "Set TCP port KMS will use to communicate with clients"
  101.  
  102. private const L_optSetDNS = "sdns"
  103. private const L_optSetDNSUsage = "Enable DNS publishing by KMS (default)"
  104.  
  105. private const L_optClearDNS = "cdns"
  106. private const L_optClearDNSUsage = "Disable DNS publishing by KMS"
  107.  
  108. private const L_optSetNormalPriority = "spri"
  109. private const L_optSetNormalPriorityUsage = "Set KMS priority to normal (default)"
  110.  
  111. private const L_optClearNormalPriority = "cpri"
  112. private const L_optClearNormalPriorityUsage = "Set KMS priority to low"
  113.  
  114. ' Token-based Activation options
  115.  
  116. private const L_optListInstalledILs = "lil"
  117. private const L_optListInstalledILsUsage = "List installed Token-based Activation Issuance Licenses"
  118.  
  119. private const L_optRemoveInstalledIL = "ril"
  120. private const L_optRemoveInstalledILUsage = "Remove installed Token-based Activation Issuance License"
  121.  
  122. private const L_optClearTkaOnly = "ctao"
  123. private const L_optClearTkaOnlyUsage = "Clear Token-based Activation Only flag (default)"
  124.  
  125. private const L_optSetTkaOnly = "stao"
  126. private const L_optSetTkaOnlyUsage = "Set Token-based Activation Only flag"
  127.  
  128. private const L_optListTkaCerts = "ltc"
  129. private const L_optListTkaCertsUsage = "List Token-based Activation Certificates"
  130.  
  131. private const L_optForceTkaActivation = "fta"
  132. private const L_optForceTkaActivationUsage = "Force Token-based Activation"
  133.  
  134. ' Option parameters
  135. private const L_ParamsActivationID = "<Activation ID>"
  136. private const L_ParamsActivationIDOptional = "[Activation ID]"
  137. private const L_ParamsActIDOptional = "[Activation ID | All]"
  138. private const L_ParamsProductKey = "<Product Key>"
  139. private const L_ParamsLicenseFile = "<License file>"
  140. private const L_ParamsPhoneActivate = "<Confirmation ID>"
  141. private const L_ParamsSetKms = "<Name[:Port] | : port> [Activation ID]"
  142. private const L_ParamsSetListenKmsPort = "<Port>"
  143. private const L_ParamsSetActivationInterval = "<Activation Interval>"
  144. private const L_ParamsSetRenewalInterval = "<Renewal Interval>"
  145.  
  146. private const L_ParamsRemoveInstalledIL = "<ILID> <ILvID>"
  147. private const L_ParamsForceTkaActivation = "<Certificate Thumbprint> [<PIN>]"
  148.  
  149. ' Miscellaneous messages
  150. private const L_MsgHelp_1 = "Windows Software Licensing Management Tool"
  151. private const L_MsgHelp_2 = "Usage: slmgr.vbs [MachineName [User Password]] [<Option>]"
  152. private const L_MsgHelp_3 = "MachineName: Name of remote machine (default is local machine)"
  153. private const L_MsgHelp_4 = "User: Account with required privilege on remote machine"
  154. private const L_MsgHelp_5 = "Password: password for the previous account"
  155. private const L_MsgGlobalOptions = "Global Options:"
  156. private const L_MsgAdvancedOptions = "Advanced Options:"
  157. private const L_MsgKmsClientOptions = "Volume Licensing: Key Management Service (KMS) Client Options:"
  158. private const L_MsgKmsOptions = "Volume Licensing: Key Management Service (KMS) Options:"
  159. private const L_MsgTkaClientOptions = "Volume Licensing: Token-based Activation Options:"
  160. private const L_MsgInvalidOptions = "Invalid combination of command parameters."
  161. private const L_MsgUnrecognizedOption = "Unrecognized option: "
  162. private const L_MsgErrorProductNotFound = "Error: product not found."
  163. private const L_MsgClearedPKey = "Product key from registry cleared successfully."
  164. private const L_MsgInstalledPKey = "Installed product key %PKEY% successfully."
  165. private const L_MsgUninstalledPKey = "Uninstalled product key successfully."
  166. private const L_MsgErrorPKey = "Error: product key not found."
  167. private const L_MsgInstallationID = "Installation ID: "
  168. private const L_MsgPhoneNumbers = "Product activation telephone numbers can be obtained by searching the phone.inf file for the appropriate phone number for your location/country. You can open the phone.inf file from a Command Prompt or the Start Menu by running: notepad %systemroot%\system32\sppui\phone.inf"
  169. private const L_MsgActivating = "Activating %PRODUCTNAME% (%PRODUCTID%) ..."
  170. private const L_MsgActivated = "Product activated successfully."
  171. private const L_MsgActivated_Failed = "Error: Product activation failed."
  172. private const L_MsgConfID = "Confirmation ID for product %ACTID% deposited successfully."
  173. private const L_MsgErrorDescription = "Error description: "
  174. private const L_MsgErrorConnection = "Error 0x%ERRCODE% occurred in connecting to server %COMPUTERNAME%."
  175. private const L_MsgInfoRemoteConnection = "Connected to server %COMPUTERNAME%."
  176. private const L_MsgErrorConnectionRegistry = "Error 0x%ERRCODE% occurred in connecting to the registry on server %COMPUTERNAME%."
  177. private const L_MsgErrorImpersonation = "Error 0x%ERRCODE% occurred in setting impersonation level."
  178. private const L_MsgErrorAuthenticationLevel = "Error 0x%ERRCODE% occurred in setting authentication level."
  179. private const L_MsgErrorWMI = "Error 0x%ERRCODE% occurred in creating a locator object."
  180. private const L_MsgErrorText_6 = "On a computer running Microsoft Windows non-core edition, run 'slui.exe 0x2a 0x%ERRCODE%' to display the error text."
  181. private const L_MsgErrorText_8 = "Error: "
  182. private const L_MsgErrorText_9 = "Error: option %OPTION% needs %PARAM%"
  183. private const L_MsgErrorText_11 = "The machine is running within the non-genuine grace period. Run 'slui.exe' to go online and make the machine genuine."
  184. private const L_MsgErrorText_12 = "Windows is running within the non-genuine notification period. Run 'slui.exe' to go online and validate Windows."
  185. private const L_MsgLicenseFile = "License file %LICENSEFILE% installed successfully."
  186. private const L_MsgKmsPriSetToLow = "KMS priority set to Low"
  187. private const L_MsgKmsPriSetToNormal = "KMS priority set to Normal"
  188. private const L_MsgWarningKmsPri = "Warning: Priority can only be set on a KMS machine that is also activated."
  189. private const L_MsgKmsDnsPublishingDisabled = "DNS publishing disabled"
  190. private const L_MsgKmsDnsPublishingEnabled = "DNS publishing enabled"
  191. private const L_MsgKmsDnsPublishingWarning = "Warning: DNS Publishing can only be set on a KMS machine that is also activated."
  192. private const L_MsgKmsPortSet = "KMS port set to %PORT% successfully."
  193. private const L_MsgWarningKmsReboot = "Warning: a KMS reboot is needed for this setting to take effect."
  194. private const L_MsgWarningKmsPort = "Warning: KMS port can only be set on a KMS machine that is also activated."
  195. private const L_MsgRenewalSet = "Volume renewal interval set to %RENEWAL% minutes successfully."
  196. private const L_MsgWarningRenewal = "Warning: Volume renewal interval can only be set on a KMS machine that is also activated."
  197. private const L_MsgActivationSet = "Volume activation interval set to %ACTIVATION% minutes successfully."
  198. private const L_MsgWarningActivation = "Warning: Volume activation interval can only be set on a KMS machine that is also activated."
  199. private const L_MsgKmsNameSet = "Key Management Service machine name set to %KMS% successfully."
  200. private const L_MsgKmsNameCleared = "Key Management Service machine name cleared successfully."
  201. private const L_MsgKmsHostCachingDisabled = "KMS host caching is disabled"
  202. private const L_MsgKmsHostCachingEnabled = "KMS host caching is enabled"
  203. private const L_MsgErrorActivationID = "Error: Activation ID (%ActID%) not found."
  204. private const L_MsgRearm_1 = "Command completed successfully."
  205. private const L_MsgRearm_2 = "Please restart the system for the changes to take effect."
  206. private const L_MsgRemainingWindowsRearmCount = "Remaining Windows rearm count: %COUNT%"
  207. ' Used for xpr
  208. private const L_MsgLicenseStatusUnlicensed = "Unlicensed"
  209. private const L_MsgLicenseStatusVL = "Volume activation will expire %ENDDATE%"
  210. private const L_MsgLicenseStatusTBL = "Timebased activation will expire %ENDDATE%"
  211. private const L_MsgLicenseStatusLicensed = "The machine is permanently activated."
  212. private const L_MsgLicenseStatusInitialGrace = "Initial grace period ends %ENDDATE%"
  213. private const L_MsgLicenseStatusAdditionalGrace = "Additional grace period ends %ENDDATE%"
  214. private const L_MsgLicenseStatusNonGenuineGrace = "Non-genuine grace period ends %ENDDATE%"
  215. private const L_MsgLicenseStatusNotification = "Windows is in Notification mode"
  216. private const L_MsgLicenseStatusExtendedGrace = "Extended grace period ends %ENDDATE%"
  217.  
  218. ' Used for dli/dlv
  219. private const L_MsgLicenseStatusUnlicensed_1 = "License Status: Unlicensed"
  220. private const L_MsgLicenseStatusLicensed_1 = "License Status: Licensed"
  221. private const L_MsgLicenseStatusVL_1 = "Volume activation expiration: %MINUTE% minute(s) (%DAY% day(s))"
  222. private const L_MsgLicenseStatusTBL_1 = "Timebased activation expiration: %MINUTE% minute(s) (%DAY% day(s))"
  223. private const L_MsgLicenseStatusInitialGrace_1 = "License Status: Initial grace period"
  224. private const L_MsgLicenseStatusAdditionalGrace_1 = "License Status: Additional grace period (KMS license expired or hardware out of tolerance)"
  225. private const L_MsgLicenseStatusNonGenuineGrace_1 = "License Status: Non-genuine grace period."
  226. private const L_MsgLicenseStatusNotification_1 = "License Status: Notification"
  227. private const L_MsgLicenseStatusExtendedGrace_1 = "License Status: Extended grace period"
  228.  
  229. private const L_MsgNotificationErrorReasonNonGenuine = "Notification Reason: 0x%ERRCODE% (non-genuine)."
  230. private const L_MsgNotificationErrorReasonExpiration = "Notification Reason: 0x%ERRCODE% (grace time expired)."
  231. private const L_MsgNotificationErrorReasonOther = "Notification Reason: 0x%ERRCODE%."
  232. private const L_MsgLicenseStatusTimeRemaining = "Time remaining: %MINUTE% minute(s) (%DAY% day(s))"
  233. private const L_MsgLicenseStatusUnknown = "License Status: Unknown"
  234. private const L_MsgLicenseStatusEvalEndData = "Evaluation End Date: "
  235. private const L_MsgReinstallingLicenses = "Re-installing license files ..."
  236. private const L_MsgLicensesReinstalled = "License files re-installed successfully."
  237. private const L_MsgServiceVersion = "Software licensing service version: "
  238. private const L_MsgProductName = "Name: "
  239. private const L_MsgProductDesc = "Description: "
  240. private const L_MsgActID = "Activation ID: "
  241. private const L_MsgAppID = "Application ID: "
  242. private const L_MsgPID4 = "Extended PID: "
  243. private const L_MsgProcessorCertUrl = "Processor Certificate URL: "
  244. private const L_MsgMachineCertUrl = "Machine Certificate URL: "
  245. private const L_MsgUseLicenseCertUrl = "Use License URL: "
  246. private const L_MsgPKeyCertUrl = "Product Key Certificate URL: "
  247. private const L_MsgPartialPKey = "Partial Product Key: "
  248. private const L_MsgErrorLicenseNotInUse = "This license is not in use."
  249. private const L_MsgKmsInfo = "Key Management Service client information"
  250. private const L_MsgCmid = "Client Machine ID (CMID): "
  251. private const L_MsgRegisteredKmsName = "Registered KMS machine name: "
  252. private const L_MsgKmsFromDnsUnavailable = "DNS auto-discovery: KMS name not available"
  253. private const L_MsgKmsFromDns = "KMS machine name from DNS: "
  254. private const L_MsgKmsPID4 = "KMS machine extended PID: "
  255. private const L_MsgActivationInterval = "Activation interval: %INTERVAL% minutes"
  256. private const L_MsgRenewalInterval = "Renewal interval: %INTERVAL% minutes"
  257. private const L_MsgKmsEnabled = "Key Management Service is enabled on this machine"
  258. private const L_MsgKmsCurrentCount = "Current count: "
  259. private const L_MsgKmsListeningOnPort = "Listening on Port: "
  260. private const L_MsgKmsPriNormal = "KMS priority: Normal"
  261. private const L_MsgKmsPriLow = "KMS priority: Low"
  262. private const L_MsgInvalidDataError = "Error: The data is invalid"
  263. private const L_MsgUndeterminedPrimaryKey = "Warning: SLMGR was not able to validate the current product key for Windows. Please upgrade to the latest service pack."
  264. private const L_MsgUndeterminedPrimaryKeyOperation = "Warning: This operation may affect more than one target license. Please verify the results."
  265. private const L_MsgUndeterminedOperationFormat = "Processing the license for %PRODUCTDESCRIPTION% (%PRODUCTID%)."
  266. private const L_MsgPleaseActivateRefreshKMSInfo = "Please use slmgr.vbs /ato to activate and update KMS client information in order to update values."
  267.  
  268. private const L_MsgKmsCumulativeRequestsFromClients = "Key Management Service cumulative requests received from clients"
  269. private const L_MsgKmsTotalRequestsRecieved = "Total requests received: "
  270. private const L_MsgKmsFailedRequestsReceived = "Failed requests received: "
  271. private const L_MsgKmsRequestsWithStatusUnlicensed = "Requests with License Status Unlicensed: "
  272. private const L_MsgKmsRequestsWithStatusLicensed = "Requests with License Status Licensed: "
  273. private const L_MsgKmsRequestsWithStatusInitialGrace = "Requests with License Status Initial grace period: "
  274. private const L_MsgKmsRequestsWithStatusLicenseExpiredOrHwidOot = "Requests with License Status License expired or Hardware out of tolerance: "
  275. private const L_MsgKmsRequestsWithStatusNonGenuineGrace = "Requests with License Status Non-genuine grace period: "
  276. private const L_MsgKmsRequestsWithStatusNotification = "Requests with License Status Notification: "
  277.  
  278. private const L_MsgRemoteWmiVersionMismatch = "The remote machine does not support this version of SLMgr.vbs"
  279.  
  280. '
  281. ' Token-based Activation issuance licenses
  282. '
  283. private const L_MsgTkaLicenses = "Token-based Activation Issuance Licenses:"
  284. private const L_MsgTkaLicenseHeader = "%ILID% %ILVID%"
  285. private const L_MsgTkaLicenseILID = "License ID (ILID): %ILID%"
  286. private const L_MsgTkaLicenseILVID = "Version ID (ILvID): %ILVID%"
  287. private const L_MsgTkaLicenseExpiration = "Valid to: %TODATE%"
  288. private const L_MsgTkaLicenseAdditionalInfo = "Additional Information: %MOREINFO%"
  289. private const L_MsgTkaLicenseAuthZStatus = "Error: 0x%ERRCODE%"
  290. private const L_MsgTkaLicenseDescr = "Description: %DESC%"
  291. private const L_MsgTkaLicenseNone = "No licenses found."
  292.  
  293. private const L_MsgTkaRemoving = "Removing Token-based Activation License ..."
  294. private const L_MsgTkaRemovedItem = "Removed license with SLID=%SLID%."
  295. private const L_MsgTkaRemovedNone = "No licenses found."
  296.  
  297. private const L_MsgTkaInfoAdditionalInfo = "Additional Information: %MOREINFO%"
  298. private const L_MsgTkaInfo = "Token-based Activation information"
  299. private const L_MsgTkaInfoILID = "License ID (ILID): %ILID%"
  300. private const L_MsgTkaInfoILVID = "Version ID (ILvID): %ILVID%"
  301. private const L_MsgTkaInfoGrantNo = "Grant Number: %GRANTNO%"
  302. private const L_MsgTkaInfoThumbprint = "Certificate Thumbprint: %THUMBPRINT%"
  303.  
  304. private const L_MsgTkaTaoSet = "The machine will activate via Token-based Activation only"
  305. private const L_MsgTkaTaoClear = "The machine will activate via KMS and Token-based Activation"
  306.  
  307. private const L_MsgTkaCertThumbprint = "Thumbprint: %THUMBPRINT%"
  308. private const L_MsgTkaCertSubject = "Subject: %SUBJECT%"
  309. private const L_MsgTkaCertIssuer = "Issuer: %ISSUER%"
  310. private const L_MsgTkaCertValidFrom = "Valid from: %FROMDATE%"
  311. private const L_MsgTkaCertValidTo = "Valid to: %TODATE%"
  312.  
  313. private const L_MsgCurrentTrustedTime = "Trusted time: "
  314.  
  315. private const NoPrimaryKeyFound = "NoPrimaryKeyFound"
  316. private const TblPrimaryKey = "TblPrimaryKey"
  317. private const NotSpecialCasePrimaryKey = "NotSpecialCasePrimaryKey"
  318. private const IndeterminatePrimaryKeyFound = "IndeterminatePrimaryKey"
  319.  
  320. private const L_MsgError_C004C001 = "The activation server determined the specified product key is invalid"
  321. private const L_MsgError_C004C003 = "The activation server determined the specified product key is blocked"
  322. private const L_MsgError_C004C017 = "The activation server determined the specified product key has been blocked for this geographic location."
  323. private const L_MsgError_C004B100 = "The activation server determined that the computer could not be activated"
  324. private const L_MsgError_C004C008 = "The activation server determined that the specified product key could not be used"
  325. private const L_MsgError_C004C020 = "The activation server reported that the Multiple Activation Key has exceeded its limit"
  326. private const L_MsgError_C004C021 = "The activation server reported that the Multiple Activation Key extension limit has been exceeded"
  327. private const L_MsgError_C004D307 = "The maximum allowed number of re-arms has been exceeded. You must re-install the OS before trying to re-arm again"
  328. private const L_MsgError_C004F009 = "The software Licensing Service reported that the grace period expired"
  329. private const L_MsgError_C004F00F = "The Software Licensing Server reported that the hardware ID binding is beyond level of tolerance"
  330. private const L_MsgError_C004F014 = "The Software Licensing Service reported that the product key is not available"
  331. private const L_MsgError_C004F025 = "Access denied: the requested action requires elevated privileges"
  332. private const L_MsgError_C004F02C = "The software Licensing Service reported that the format for the offline activation data is incorrect"
  333. private const L_MsgError_C004F035 = "The software Licensing Service reported that the computer could not be activated with a Volume license product key. Volume licensed systems require upgrading from a qualified operating system. Please contact your system administrator or use a different type of key"
  334. private const L_MsgError_C004F038 = "The software Licensing Service reported that the computer could not be activated. The count reported by your Key Management Service (KMS) is insufficient. Please contact your system administrator"
  335. private const L_MsgError_C004F039 = "The software Licensing Service reported that the computer could not be activated. The Key Management Service (KMS) is not enabled"
  336. private const L_MsgError_C004F041 = "The software Licensing Service determined that the Key Management Server (KMS) is not activated. KMS needs to be activated"
  337. private const L_MsgError_C004F042 = "The software Licensing Service determined that the specified Key Management Service (KMS) cannot be used"
  338. private const L_MsgError_C004F050 = "The Software Licensing Service reported that the product key is invalid"
  339. private const L_MsgError_C004F051 = "The software Licensing Service reported that the product key is blocked"
  340. private const L_MsgError_C004F064 = "The software Licensing Service reported that the non-Genuine grace period expired"
  341. private const L_MsgError_C004F065 = "The software Licensing Service reported that the application is running within the valid non-genuine period"
  342. private const L_MsgError_C004F066 = "The Software Licensing Service reported that the product SKU is not found"
  343. private const L_MsgError_C004F06B = "The software Licensing Service determined that it is running in a virtual machine. The Key Management Service (KMS) is not supported in this mode"
  344. private const L_MsgError_C004F074 = "The Software Licensing Service reported that the computer could not be activated. The Key Management Service (KMS) is unavailable"
  345. private const L_MsgError_C004F075 = "The Software Licensing Service reported that the operation cannot be completed because the service is stopping"
  346.  
  347. private const L_MsgError_C004F304 = "The Software Licensing Service reported that required license could not be found."
  348. private const L_MsgError_C004F305 = "The Software Licensing Service reported that there are no certificates found in the system that could activate the product."
  349. private const L_MsgError_C004F30A = "The Software Licensing Service reported that the computer could not be activated. The certificate does not match the conditions in the license."
  350. private const L_MsgError_C004F30D = "The Software Licensing Service reported that the computer could not be activated. The thumbprint is invalid."
  351. private const L_MsgError_C004F30E = "The Software Licensing Service reported that the computer could not be activated. A certificate for the thumbprint could not be found."
  352.  
  353. private const L_MsgError_C004F30F = "The Software Licensing Service reported that the computer could not be activated. The certificate does not match the criteria specified in the issuance license."
  354. private const L_MsgError_C004F310 = "The Software Licensing Service reported that the computer could not be activated. The certificate does not match the trust point identifier (TPID) specified in the issuance license."
  355. private const L_MsgError_C004F311 = "The Software Licensing Service reported that the computer could not be activated. A soft token cannot be used for activation."
  356. private const L_MsgError_C004F312 = "The Software Licensing Service reported that the computer could not be activated. The certificate cannot be used because its private key is exportable."
  357.  
  358. private const L_MsgError_5 = "Access denied: the requested action requires elevated privileges"
  359. private const L_MsgError_80070005 = "Access denied: the requested action requires elevated privileges"
  360. private const L_MsgError_80070057 = "The parameter is incorrect"
  361. private const L_MsgError_8007232A = "DNS server failure"
  362. private const L_MsgError_8007232B = "DNS name does not exist"
  363. private const L_MsgError_800706BA = "The RPC server is unavailable"
  364. private const L_MsgError_8007251D = "No records found for DNS query"
  365.  
  366. ' Registry constants
  367. private const HKEY_LOCAL_MACHINE = &H80000002
  368. private const HKEY_NETWORK_SERVICE = &H80000003
  369.  
  370. private const DefaultPort = "1688"
  371. private const intKnownOption = 0
  372. private const intUnknownOption = 1
  373.  
  374. private const SLKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
  375. private const SLKeyPath32 = "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
  376. private const NSKeyPath = "S-1-5-20\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform"
  377.  
  378. private const HR_S_OK = 0
  379. private const HR_ERROR_FILE_NOT_FOUND = &H80070002
  380. private const HR_SL_E_GRACE_TIME_EXPIRED = &HC004F009
  381. private const HR_SL_E_NOT_GENUINE = &HC004F200
  382.  
  383. ' WMI class names
  384. private const ServiceClass = "SoftwareLicensingService"
  385. private const ProductClass = "SoftwareLicensingProduct"
  386. private const TkaLicenseClass = "SoftwareLicensingTokenActivationLicense"
  387. private const WindowsAppId = "55c92734-d682-4d71-983e-d6ec3f16059f"
  388.  
  389. private const ProductIsPrimarySkuSelectClause = "ID, ApplicationId, PartialProductKey, LicenseIsAddon, Description, Name"
  390.  
  391. private const PartialProductKeyNonNullWhereClause = "PartialProductKey <> null"
  392. private const EmptyWhereClause = ""
  393.  
  394. private const wbemImpersonationLevelImpersonate = 3
  395. private const wbemAuthenticationLevelPktPrivacy = 6
  396.  
  397. Call ExecCommandLine()
  398. ExitScript 0
  399.  
  400. Private Sub DisplayUsage ()
  401.  
  402. LineOut GetResource("L_MsgHelp_1")
  403. LineOut GetResource("L_MsgHelp_2")
  404. LineOut " " & GetResource("L_MsgHelp_3")
  405. LineOut " " & GetResource("L_MsgHelp_4")
  406. LineOut " " & GetResource("L_MsgHelp_5")
  407. LineOut ""
  408. LineOut GetResource("L_MsgGlobalOptions")
  409. OptLine GetResource("L_optInstallProductKey"), GetResource("L_ParamsProductKey"), GetResource("L_optInstallProductKeyUsage")
  410. OptLine GetResource("L_optActivateProduct"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optActivateProductUsage")
  411. OptLine GetResource("L_optDisplayInformation"), GetResource("L_ParamsActIDOptional"), GetResource("L_optDisplayInformationUsage")
  412. OptLine GetResource("L_optDisplayInformationVerbose"), GetResource("L_ParamsActIDOptional"), GetResource("L_optDisplayInformationUsageVerbose")
  413. OptLine GetResource("L_optExpirationDatime"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optExpirationDatimeUsage")
  414.  
  415. LineFlush ""
  416.  
  417. LineOut GetResource("L_MsgAdvancedOptions")
  418. OptLine GetResource("L_optClearPKeyFromRegistry"), "", GetResource("L_optClearPKeyFromRegistryUsage")
  419. OptLine GetResource("L_optInstallLicense"), GetResource("L_ParamsLicenseFile"), GetResource("L_optInstallLicenseUsage")
  420. OptLine GetResource("L_optReinstallLicenses"), "", GetResource("L_optReinstallLicensesUsage")
  421. OptLine GetResource("L_optReArmWindows"), "", GetResource("L_optReArmWindowsUsage")
  422. OptLine GetResource("L_optUninstallProductKey"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optUninstallProductKeyUsage")
  423.  
  424.  
  425. LineOut ""
  426. OptLine GetResource("L_optDisplayIID"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optDisplayIIDUsage")
  427. OptLine2 GetResource("L_optPhoneActivateProduct"), GetResource("L_ParamsPhoneActivate"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optPhoneActivateProductUsage")
  428.  
  429. LineOut ""
  430. LineOut GetResource("L_MsgKmsClientOptions")
  431. OptLine2 GetResource("L_optSetKmsName"), GetResource("L_ParamsSetKms"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optSetKmsNameUsage")
  432. OptLine GetResource("L_optClearKmsName"), GetResource("L_ParamsActivationIDOptional"), GetResource("L_optClearKmsNameUsage")
  433. OptLine GetResource("L_optSetKmsHostCaching"), "", GetResource("L_optSetKmsHostCachingUsage")
  434. OptLine GetResource("L_optClearKmsHostCaching"), "", GetResource("L_optClearKmsHostCachingUsage")
  435.  
  436. LineFlush ""
  437.  
  438. LineOut GetResource("L_MsgTkaClientOptions")
  439. OptLine GetResource("L_optListInstalledILs"), "", GetResource("L_optListInstalledILsUsage")
  440. OptLine GetResource("L_optRemoveInstalledIL"), GetResource("L_ParamsRemoveInstalledIL"), GetResource("L_optRemoveInstalledILUsage")
  441. OptLine GetResource("L_optClearTkaOnly"), "", GetResource("L_optClearTkaOnlyUsage")
  442. OptLine GetResource("L_optSetTkaOnly"), "", GetResource("L_optSetTkaOnlyUsage")
  443. OptLine GetResource("L_optListTkaCerts"), "", GetResource("L_optListTkaCertsUsage")
  444. OptLine GetResource("L_optForceTkaActivation"), GetResource("L_ParamsForceTkaActivation"), GetResource("L_optForceTkaActivationUsage")
  445.  
  446. LineFlush ""
  447.  
  448. LineOut GetResource("L_MsgKmsOptions")
  449. OptLine GetResource("L_optSetKmsListenPort"), GetResource("L_ParamsSetListenKmsPort"), GetResource("L_optSetKmsListenPortUsage")
  450. OptLine GetResource("L_optSetActivationInterval"), GetResource("L_ParamsSetActivationInterval"), GetResource("L_optSetActivationIntervalUsage")
  451. OptLine GetResource("L_optSetRenewalInterval"), GetResource("L_ParamsSetRenewalInterval"), GetResource("L_optSetRenewalIntervalUsage")
  452. OptLine GetResource("L_optSetDNS"), "", GetResource("L_optSetDNSUsage")
  453. OptLine GetResource("L_optClearDNS"), "", GetResource("L_optClearDNSUsage")
  454. OptLine GetResource("L_optSetNormalPriority"), "", GetResource("L_optSetNormalPriorityUsage")
  455. OptLine GetResource("L_optClearNormalPriority"), "", GetResource("L_optClearNormalPriorityUsage")
  456.  
  457. ExitScript 1
  458. End Sub
  459.  
  460. Private Sub OptLine(strOption, strParams, strUsage)
  461. LineOut "/" & strOption & " " & strParams
  462. LineOut " " & strUsage
  463. End Sub
  464.  
  465. Private Sub OptLine2(strOption, strParam1, strParam2, strUsage)
  466. LineOut "/" & strOption & " " & strParam1 & " " & strParam2
  467. LineOut " " & strUsage
  468. End Sub
  469.  
  470. Private Sub ExecCommandLine
  471. Dim intOption, indexOption
  472. Dim strOption, chOpt
  473. Dim remoteInfo(3)
  474.  
  475. '
  476. ' First three parameters before "/" or "-" may be remote connection info
  477. '
  478.  
  479. remoteInfo(0) = "."
  480. intOption = intUnknownOption
  481.  
  482. For indexOption = 0 To 3
  483. If indexOption >= WScript.Arguments.Count Then
  484. Exit For
  485. End If
  486.  
  487. strOption = WScript.Arguments.Item(indexOption)
  488.  
  489. chOpt = Left(strOption, 1)
  490. If chOpt = "/" Or chOpt = "-" Then
  491. intOption = intKnownOption
  492. Exit For
  493. End If
  494.  
  495. remoteInfo(indexOption) = strOption
  496. Next
  497.  
  498. '
  499. ' Connect to remote only if syntax is reasonably good
  500. '
  501.  
  502. If intUnknownOption = intOption Or 2 = indexOption Then
  503. g_strComputer = "."
  504. intOption = intUnknownOption
  505. Else
  506. g_strComputer = remoteInfo(0)
  507. g_strUserName = remoteInfo(1)
  508. g_strPassword = remoteInfo(2)
  509. End If
  510.  
  511. If Not booleanConnect() Then
  512. ExitScript 1
  513. End If
  514.  
  515. If intUnknownOption = intOption Then
  516. LineOut GetResource("L_MsgInvalidOptions")
  517. LineOut ""
  518. Call DisplayUsage()
  519. End If
  520.  
  521. intOption = ParseCommandLine(indexOption)
  522.  
  523. If intUnknownOption = intOption Then
  524. LineOut GetResource("L_MsgUnrecognizedOption") & WScript.Arguments.Item(indexOption)
  525. LineOut ""
  526. Call DisplayUsage()
  527. End If
  528. End Sub
  529.  
  530. Private Function ParseCommandLine(index)
  531. Dim strOption, chOpt
  532.  
  533. ParseCommandLine = intKnownOption
  534.  
  535. strOption = LCase(WScript.Arguments.Item(index))
  536.  
  537. chOpt = Left(strOption, 1)
  538.  
  539. If (chOpt <> "-") And (chOpt <> "/") Then
  540. ParseCommandLine = intUnknownOption
  541. Exit Function
  542. End If
  543.  
  544. strOption = Right(strOption, Len(strOption) - 1)
  545.  
  546. If strOption = GetResource("L_optInstallLicense") Then
  547.  
  548. If HandleOptionParam(index+1, True, GetResource("L_optInstallLicense"), GetResource("L_ParamsLicenseFile")) Then
  549. InstallLicense WScript.Arguments.Item(index+1)
  550. End If
  551.  
  552. ElseIf strOption = GetResource("L_optInstallProductKey") Then
  553.  
  554. If HandleOptionParam(index+1, True, GetResource("L_optInstallProductKey"), GetResource("L_ParamsProductKey")) Then
  555. InstallProductKey WScript.Arguments.Item(index+1)
  556. End If
  557.  
  558. ElseIf strOption = GetResource("L_optUninstallProductKey") Then
  559.  
  560. If HandleOptionParam(index+1, False, GetResource("L_optUninstallProductKey"), GetResource("L_ParamsActivationIDOptional")) Then
  561. UninstallProductKey WScript.Arguments.Item(index+1)
  562. Else
  563. UninstallProductKey ""
  564. End If
  565.  
  566. ElseIf strOption = GetResource("L_optDisplayIID") Then
  567.  
  568. If HandleOptionParam(index+1, False, GetResource("L_optDisplayIID"), GetResource("L_ParamsActivationIDOptional")) Then
  569. DisplayIID WScript.Arguments.Item(index+1)
  570. Else
  571. DisplayIID ""
  572. End If
  573.  
  574. ElseIf strOption = GetResource("L_optActivateProduct") Then
  575.  
  576. If HandleOptionParam(index+1, False, GetResource("L_optActivateProduct"), GetResource("L_ParamsActivationIDOptional")) Then
  577. ActivateProduct WScript.Arguments.Item(index+1)
  578. Else
  579. ActivateProduct ""
  580. End If
  581.  
  582. ElseIf strOption = GetResource("L_optPhoneActivateProduct") Then
  583.  
  584. If HandleOptionParam(index+1, True, GetResource("L_optPhoneActivateProduct"), GetResource("L_ParamsPhoneActivate")) Then
  585. If HandleOptionParam(index+2, False, GetResource("L_optPhoneActivateProduct"), GetResource("L_ParamsActivationIDOptional")) Then
  586. PhoneActivateProduct WScript.Arguments.Item(index+1), WScript.Arguments.Item(index+2)
  587. Else
  588. PhoneActivateProduct WScript.Arguments.Item(index+1), ""
  589. End If
  590. End If
  591.  
  592. ElseIf strOption = GetResource("L_optDisplayInformation") Then
  593.  
  594. If HandleOptionParam(index+1, False, GetResource("L_optDisplayInformation"), "") Then
  595. DisplayAllInformation WScript.Arguments.Item(index+1), False
  596. Else
  597. DisplayAllInformation "", False
  598. End If
  599.  
  600. ElseIf strOption = GetResource("L_optDisplayInformationVerbose") Then
  601.  
  602. If HandleOptionParam(index+1, False, GetResource("L_optDisplayInformationVerbose"), "") Then
  603. DisplayAllInformation WScript.Arguments.Item(index+1), True
  604. Else
  605. DisplayAllInformation "", True
  606. End If
  607.  
  608. ElseIf strOption = GetResource("L_optClearPKeyFromRegistry") Then
  609.  
  610. ClearPKeyFromRegistry
  611.  
  612. ElseIf strOption = GetResource("L_optReinstallLicenses") Then
  613.  
  614. ReinstallLicenses
  615.  
  616. ElseIf strOption = GetResource("L_optReArmWindows") Then
  617.  
  618. ReArmWindows()
  619.  
  620. ElseIf strOption = GetResource("L_optExpirationDatime") Then
  621.  
  622. If HandleOptionParam(index+1, False, GetResource("L_optExpirationDatime"), GetResource("L_ParamsActivationIDOptional")) Then
  623. ExpirationDatime WScript.Arguments.Item(index+1)
  624. Else
  625. ExpirationDatime ""
  626. End If
  627.  
  628. ElseIf strOption = GetResource("L_optSetKmsName") Then
  629.  
  630. If HandleOptionParam(index+1, True, GetResource("L_optSetKmsName"), GetResource("L_ParamsSetKms")) Then
  631. If HandleOptionParam(index+2, False, GetResource("L_optSetKmsName"), GetResource("L_ParamsActivationIDOptional")) Then
  632. SetKmsMachineName WScript.Arguments.Item(index+1), WScript.Arguments.Item(index+2)
  633. Else
  634. SetKmsMachineName WScript.Arguments.Item(index+1), ""
  635. End If
  636. End If
  637.  
  638. ElseIf strOption = GetResource("L_optClearKmsName") Then
  639.  
  640. If HandleOptionParam(index+1, False, GetResource("L_optClearKmsName"), GetResource("L_ParamsActivationIDOptional")) Then
  641. ClearKms WScript.Arguments.Item(index+1)
  642. Else
  643. ClearKms ""
  644. End If
  645.  
  646. ElseIf strOption = GetResource("L_optSetKmsHostCaching") Then
  647.  
  648. SetHostCachingDisable(False)
  649.  
  650. ElseIf strOption = GetResource("L_optClearKmsHostCaching") Then
  651.  
  652. SetHostCachingDisable(True)
  653.  
  654. ElseIf strOption = GetResource("L_optSetActivationInterval") Then
  655.  
  656. If HandleOptionParam(index+1, True, GetResource("L_optSetActivationInterval"), GetResource("L_ParamsSetActivationInterval")) Then
  657. SetActivationInterval WScript.Arguments.Item(index+1)
  658. End If
  659.  
  660. ElseIf strOption = GetResource("L_optSetRenewalInterval") Then
  661.  
  662. If HandleOptionParam(index+1, True, GetResource("L_optSetRenewalInterval"), GetResource("L_ParamsSetRenewalInterval")) Then
  663. SetRenewalInterval WScript.Arguments.Item(index+1)
  664. End If
  665.  
  666. ElseIf strOption = GetResource("L_optSetKmsListenPort") Then
  667.  
  668. If HandleOptionParam(index+1, True, GetResource("L_optSetKmsListenPort"), GetResource("L_ParamsSetListenKmsPort")) Then
  669. SetKmsListenPort WScript.Arguments.Item(index+1)
  670. End If
  671.  
  672. ElseIf strOption = GetResource("L_optSetDNS") Then
  673.  
  674. SetDnsPublishingDisabled(False)
  675.  
  676. ElseIf strOption = GetResource("L_optClearDNS") Then
  677.  
  678. SetDnsPublishingDisabled(True)
  679.  
  680. ElseIf strOption = GetResource("L_optSetNormalPriority") Then
  681.  
  682. SetKmsLowPriority(False)
  683.  
  684. ElseIf strOption = GetResource("L_optClearNormalPriority") Then
  685.  
  686. SetKmsLowPriority(True)
  687.  
  688. ElseIf strOption = GetResource("L_optListInstalledILs") Then
  689.  
  690. TkaListILs
  691.  
  692. ElseIf strOption = GetResource("L_optRemoveInstalledIL") Then
  693.  
  694. If HandleOptionParam(index+2, True, GetResource("L_optRemoveInstalledIL"), GetResource("L_ParamsRemoveInstalledIL")) Then
  695. TkaRemoveIL WScript.Arguments.Item(index+1), WScript.Arguments.Item(index+2)
  696. End If
  697.  
  698. ElseIf strOption = GetResource("L_optClearTkaOnly") Then
  699.  
  700. TkaSetTokenActivationOnly False
  701.  
  702. ElseIf strOption = GetResource("L_optSetTkaOnly") Then
  703.  
  704. TkaSetTokenActivationOnly True
  705.  
  706. ElseIf strOption = GetResource("L_optListTkaCerts") Then
  707.  
  708. TkaListCerts
  709.  
  710. ElseIf strOption = GetResource("L_optForceTkaActivation") Then
  711.  
  712. If HandleOptionParam(index+2, False, GetResource("L_optForceTkaActivation"), GetResource("L_ParamsForceTkaActivation")) Then
  713. TkaActivate WScript.Arguments.Item(index+1), WScript.Arguments.Item(index+2)
  714. ElseIf HandleOptionParam(index+1, True, GetResource("L_optForceTkaActivation"), GetResource("L_ParamsForceTkaActivation")) Then
  715. TkaActivate WScript.Arguments.Item(index+1), ""
  716. End If
  717.  
  718. Else
  719.  
  720. ParseCommandLine = intUnknownOption
  721.  
  722. End If
  723.  
  724. End Function
  725.  
  726. ' global options
  727.  
  728. Private Function CheckProductForCommand(objProduct, strActivationID)
  729. Dim bCheckProductForCommand
  730.  
  731. bCheckProductForCommand = False
  732.  
  733. If (strActivationID = "" And LCase(objProduct.ApplicationId) = WindowsAppId And (objProduct.LicenseIsAddon = False)) Then
  734. bCheckProductForCommand = True
  735. End If
  736.  
  737. If (LCase(objProduct.ID) = strActivationID) Then
  738. bCheckProductForCommand = True
  739. End If
  740.  
  741. CheckProductForCommand = bCheckProductForCommand
  742. End Function
  743.  
  744. Private Sub UninstallProductKey(strActivationID)
  745. Dim objService, objProduct
  746. Dim lRet, strVersion, strDescription
  747. Dim kmsServerFound, uninstallDone
  748. Dim iIsPrimaryWindowsSku, bPrimaryWindowsSkuKeyUninstalled
  749. Dim bCheckProductForCommand
  750.  
  751. On Error Resume Next
  752.  
  753. strActivationID = LCase(strActivationID)
  754. kmsServerFound = False
  755. uninstallDone = False
  756.  
  757. set objService = GetServiceObject("Version")
  758. strVersion = objService.Version
  759.  
  760. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", ProductKeyID", PartialProductKeyNonNullWhereClause)
  761. strDescription = objProduct.Description
  762.  
  763. bCheckProductForCommand = CheckProductForCommand(objProduct, strActivationID)
  764.  
  765. If (bCheckProductForCommand) Then
  766. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  767. If (strActivationID = "") And (iIsPrimaryWindowsSku = 2) Then
  768. OutputIndeterminateOperationWarning(objProduct)
  769. End If
  770.  
  771. objProduct.UninstallProductKey()
  772. QuitIfError()
  773.  
  774. ' Uninstalling a product key could change Windows licensing state.
  775. ' Since the service determines if it can shut down and when is the next start time
  776. ' based on the licensing state we should reconsume the licenses here.
  777. objService.RefreshLicenseStatus()
  778.  
  779. ' For Windows (i.e. if no activationID specified), always
  780. ' ensure that product-key for primary SKU is uninstalled
  781. If (strActivationID <> "") Or (iIsPrimaryWindowsSku = 1) Then
  782. uninstallDone = True
  783. End If
  784.  
  785. LineOut GetResource("L_MsgUninstalledPKey")
  786.  
  787. ' Check whether a ActID belongs to KMS server.
  788. ' Do this for all ActID other than one whose pkey is being uninstalled
  789. ElseIf IsKmsServer(strDescription) Then
  790. kmsServerFound = True
  791. End If
  792.  
  793. If (kmsServerFound = True) And (uninstallDone = True) Then
  794. Exit For
  795. End If
  796. Next
  797.  
  798. If kmsServerFound = True Then
  799. ' Set the KMS version in the registry (both 64 and 32 bit locations)
  800. lRet = SetRegistryStr(HKEY_LOCAL_MACHINE, SLKeyPath, "KeyManagementServiceVersion", strVersion)
  801. If (lRet <> 0) Then
  802. QuitWithError Hex(lRet)
  803. End If
  804.  
  805. lRet = SetRegistryStr(HKEY_LOCAL_MACHINE, SLKeyPath32, "KeyManagementServiceVersion", strVersion)
  806. If (lRet <> 0) Then
  807. QuitWithError Hex(lRet)
  808. End If
  809. Else
  810. ' Clear the KMS version from the registry (both 64 and 32 bit locations)
  811. lRet = DeleteRegistryValue(HKEY_LOCAL_MACHINE, SLKeyPath, "KeyManagementServiceVersion")
  812. If (lRet <> 0 And lRet <> 2) Then
  813. QuitWithError Hex(lRet)
  814. End If
  815.  
  816. lRet = DeleteRegistryValue(HKEY_LOCAL_MACHINE, SLKeyPath32, "KeyManagementServiceVersion")
  817. If (lRet <> 0 And lRet <> 2) Then
  818. QuitWithError Hex(lRet)
  819. End If
  820. End If
  821.  
  822. If uninstallDone = False Then
  823. LineOut GetResource("L_MsgErrorPKey")
  824. End If
  825. End Sub
  826.  
  827. Private Sub DisplayIID(strActivationID)
  828. Dim objProduct
  829. Dim iIsPrimaryWindowsSku, bFoundAtLeastOneKey
  830. Dim bCheckProductForCommand
  831.  
  832. strActivationID = LCase(strActivationID)
  833.  
  834. bFoundAtLeastOneKey = False
  835. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", OfflineInstallationId", PartialProductKeyNonNullWhereClause)
  836.  
  837. bCheckProductForCommand = CheckProductForCommand(objProduct, strActivationID)
  838.  
  839. If (bCheckProductForCommand) Then
  840. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  841. If (strActivationID = "") And (iIsPrimaryWindowsSku = 2) Then
  842. OutputIndeterminateOperationWarning(objProduct)
  843. End If
  844.  
  845. LineOut GetResource("L_MsgInstallationID") & objProduct.OfflineInstallationId
  846. bFoundAtLeastOneKey = True
  847.  
  848. If (strActivationID <> "") Or (iIsPrimaryWindowsSku = 1) Then
  849. Exit Sub
  850. End If
  851. End If
  852. Next
  853.  
  854. If (bFoundAtLeastOneKey = TRUE) Then
  855. LineOut ""
  856. LineOut GetResource("L_MsgPhoneNumbers")
  857. Else
  858. LineOut GetResource("L_MsgErrorProductNotFound")
  859. End If
  860. End Sub
  861.  
  862. Private Sub DisplayActivatingSku(objProduct)
  863. Dim strOutput
  864.  
  865. strOutput = Replace(GetResource("L_MsgActivating"), "%PRODUCTNAME%", objProduct.Name)
  866. strOutput = Replace(strOutput, "%PRODUCTID%", objProduct.ID)
  867. LineFlush strOutput
  868. End Sub
  869.  
  870. Private Sub DisplayActivatedStatus(objProduct)
  871. If (objProduct.LicenseStatus = 1) Then
  872. LineOut GetResource("L_MsgActivated")
  873. ElseIf (objProduct.LicenseStatus = 4) Then
  874. LineOut GetResource("L_MsgErrorText_8") & GetResource("L_MsgErrorText_11")
  875. ElseIf ((objProduct.LicenseStatus = 5) And (objProduct.LicenseStatusReason = HR_SL_E_NOT_GENUINE)) Then
  876. LineOut GetResource("L_MsgErrorText_8") & GetResource("L_MsgErrorText_12")
  877. ElseIf (objProduct.LicenseStatus = 6) Then
  878. LineOut GetResource("L_MsgActivated")
  879. LineOut GetResource("L_MsgLicenseStatusExtendedGrace_1")
  880. Else
  881. LineOut GetResource("L_MsgActivated_Failed")
  882. End If
  883. End Sub
  884.  
  885. Private Sub ActivateProduct(strActivationID)
  886. Dim objService, objProduct
  887. Dim iIsPrimaryWindowsSku, bFoundAtLeastOneKey
  888. Dim strOutput
  889. Dim bCheckProductForCommand
  890.  
  891. strActivationID = LCase(strActivationID)
  892.  
  893. bFoundAtLeastOneKey = False
  894.  
  895. set objService = GetServiceObject("Version")
  896.  
  897. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", LicenseStatus", PartialProductKeyNonNullWhereClause)
  898.  
  899. bCheckProductForCommand = CheckProductForCommand(objProduct, strActivationID)
  900.  
  901. If (bCheckProductForCommand) Then
  902. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  903. If (strActivationID = "") And (iIsPrimaryWindowsSku = 2) Then
  904. OutputIndeterminateOperationWarning(objProduct)
  905. End If
  906.  
  907. strOutput = Replace(GetResource("L_MsgActivating"), "%PRODUCTNAME%", objProduct.Name)
  908. strOutput = Replace(strOutput, "%PRODUCTID%", objProduct.ID)
  909. LineOut strOutput
  910. On Error Resume Next
  911. objProduct.Activate()
  912. QuitIfError()
  913. objService.RefreshLicenseStatus()
  914. objProduct.refresh_
  915. DisplayActivatedStatus objProduct
  916.  
  917. bFoundAtLeastOneKey = True
  918. If (strActivationID <> "") Or (iIsPrimaryWindowsSku = 1) Then
  919. Exit Sub
  920. End If
  921. End If
  922. Next
  923.  
  924. If (bFoundAtLeastOneKey = True) Then
  925. Exit Sub
  926. End If
  927.  
  928. LineOut GetResource("L_MsgErrorProductNotFound")
  929. End Sub
  930.  
  931. Private Sub PhoneActivateProduct(strCID, strActivationID)
  932. Dim objService, objProduct
  933. Dim iIsPrimaryWindowsSku, bFoundAtLeastOneKey
  934. Dim strOutput
  935. Dim bCheckProductForCommand
  936.  
  937. strActivationID = LCase(strActivationID)
  938.  
  939. bFoundAtLeastOneKey = False
  940. set objService = GetServiceObject("Version")
  941.  
  942. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", OfflineInstallationId, LicenseStatus, LicenseStatusReason", PartialProductKeyNonNullWhereClause)
  943.  
  944. bCheckProductForCommand = CheckProductForCommand(objProduct, strActivationID)
  945.  
  946. If (bCheckProductForCommand) Then
  947. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  948. If (strActivationID = "") And (iIsPrimaryWindowsSku = 2) Then
  949. OutputIndeterminateOperationWarning(objProduct)
  950. End If
  951.  
  952. On Error Resume Next
  953. objProduct.DepositOfflineConfirmationId objProduct.OfflineInstallationId, strCID
  954. QuitIfError()
  955. objService.RefreshLicenseStatus()
  956. objProduct.refresh_
  957. If (objProduct.LicenseStatus = 1) Then
  958. strOutput = Replace(GetResource("L_MsgConfID"), "%ACTID%", objProduct.ID)
  959. LineOut strOutput
  960. ElseIf (objProduct.LicenseStatus = 4) Then
  961. LineOut GetResource("L_MsgErrorText_8") & GetResource("L_MsgErrorText_11")
  962. ElseIf ((objProduct.LicenseStatus = 5) And (objProduct.LicenseStatusReason = HR_SL_E_NOT_GENUINE)) Then
  963. LineOut GetResource("L_MsgErrorText_8") & GetResource("L_MsgErrorText_12")
  964. ElseIf (objProduct.LicenseStatus = 6) Then
  965. LineOut GetResource("L_MsgActivated")
  966. LineOut GetResource("L_MsgLicenseStatusExtendedGrace_1")
  967. Else
  968. LineOut GetResource("L_MsgActivated_Failed")
  969. End If
  970.  
  971. bFoundAtLeastOneKey = True
  972. If (strActivationID <> "") Or (iIsPrimaryWindowsSku = 1) Then
  973. Exit Sub
  974. End If
  975. End If
  976. Next
  977.  
  978. If (bFoundAtLeastOneKey = True) Then
  979. Exit Sub
  980. End If
  981.  
  982. LineOut GetResource("L_MsgErrorProductNotFound")
  983. End Sub
  984.  
  985. Private Sub DisplayKMSInformation(objService, objProduct)
  986. Dim dwValue
  987. Dim boolValue
  988. Dim KeyManagementServiceTotalRequests
  989.  
  990. Dim objProductKMSValues
  991.  
  992. set objProductKMSValues = GetProductObject( _
  993. "IsKeyManagementServiceMachine, KeyManagementServiceCurrentCount, " & _
  994. "KeyManagementServiceTotalRequests, KeyManagementServiceFailedRequests, " & _
  995. "KeyManagementServiceUnlicensedRequests, KeyManagementServiceLicensedRequests, " & _
  996. "KeyManagementServiceOOBGraceRequests, KeyManagementServiceOOTGraceRequests, " & _
  997. "KeyManagementServiceNonGenuineGraceRequests, KeyManagementServiceNotificationRequests", _
  998. "id = '" & objProduct.ID & "'")
  999.  
  1000. If objProductKMSValues.IsKeyManagementServiceMachine > 0 Then
  1001. LineOut ""
  1002. LineOut GetResource("L_MsgKmsEnabled")
  1003. LineOut " " & GetResource("L_MsgKmsCurrentCount") & objProductKMSValues.KeyManagementServiceCurrentCount
  1004.  
  1005. dwValue = objService.KeyManagementServiceListeningPort
  1006. If 0 = dwValue Then
  1007. LineOut " " & GetResource("L_MsgKmsListeningOnPort") & DefaultPort
  1008. Else
  1009. LineOut " " & GetResource("L_MsgKmsListeningOnPort") & dwValue
  1010. End If
  1011.  
  1012. boolValue = objService.KeyManagementServiceDnsPublishing
  1013. If true = boolValue Then
  1014. LineOut " " & GetResource("L_MsgKmsDnsPublishingEnabled")
  1015. Else
  1016. LineOut " " & GetResource("L_MsgKmsDnsPublishingDisabled")
  1017. End If
  1018.  
  1019. boolValue = objService.KeyManagementServiceLowPriority
  1020. If false = boolValue Then
  1021. LineOut " " & GetResource("L_MsgKmsPriNormal")
  1022. Else
  1023. LineOut " " & GetResource("L_MsgKmsPriLow")
  1024. End If
  1025.  
  1026. On Error Resume Next
  1027.  
  1028. KeyManagementServiceTotalRequests = objProductKMSValues.KeyManagementServiceTotalRequests
  1029.  
  1030. If (Not(IsNull(KeyManagementServiceTotalRequests))) And (Not(IsEmpty(KeyManagementServiceTotalRequests))) Then
  1031. LineOut ""
  1032. LineOut GetResource("L_MsgKmsCumulativeRequestsFromClients")
  1033. LineOut " " & GetResource("L_MsgKmsTotalRequestsRecieved") & objProductKMSValues.KeyManagementServiceTotalRequests
  1034. LineOut " " & GetResource("L_MsgKmsFailedRequestsReceived") & objProductKMSValues.KeyManagementServiceFailedRequests
  1035. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusUnlicensed") & objProductKMSValues.KeyManagementServiceUnlicensedRequests
  1036. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusLicensed") & objProductKMSValues.KeyManagementServiceLicensedRequests
  1037. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusInitialGrace") & objProductKMSValues.KeyManagementServiceOOBGraceRequests
  1038. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusLicenseExpiredOrHwidOot") & objProductKMSValues.KeyManagementServiceOOTGraceRequests
  1039. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusNonGenuineGrace") & objProductKMSValues.KeyManagementServiceNonGenuineGraceRequests
  1040. LineOut " " & GetResource("L_MsgKmsRequestsWithStatusNotification") & objProductKMSValues.KeyManagementServiceNotificationRequests
  1041. End If
  1042. End If
  1043. End Sub
  1044.  
  1045. Private Sub DisplayTkaClientInformation(objService, objProduct)
  1046. LineOut ""
  1047. LineOut GetResource("L_MsgTkaInfo")
  1048.  
  1049. LineOut " " & Replace(GetResource("L_MsgTkaInfoILID" ), "%ILID%" , objProduct.TokenActivationILID)
  1050. LineOut " " & Replace(GetResource("L_MsgTkaInfoILVID" ), "%ILVID%" , objProduct.TokenActivationILVID)
  1051. LineOut " " & Replace(GetResource("L_MsgTkaInfoGrantNo" ), "%GRANTNO%" , objProduct.TokenActivationGrantNumber)
  1052. LineOut " " & Replace(GetResource("L_MsgTkaInfoThumbprint"), "%THUMBPRINT%", objProduct.TokenActivationCertificateThumbprint)
  1053. End Sub
  1054.  
  1055. Private Sub DisplayKMSClientInformation(objService, objProduct)
  1056. Dim strKms, strPort, strOutput
  1057. Dim iVLRenewalInterval, iVLActivationInterval
  1058.  
  1059. iVLRenewalInterval = objProduct.VLRenewalInterval
  1060. iVLActivationInterval = objProduct.VLActivationInterval
  1061.  
  1062. LineOut ""
  1063. LineOut GetResource("L_MsgKmsInfo")
  1064. LineOut " " & GetResource("L_MsgCmid") & objService.ClientMachineID
  1065.  
  1066. strKms = objProduct.KeyManagementServiceMachine
  1067.  
  1068. if strKms <> "" And Not IsNull(strKms) Then
  1069. strPort = objProduct.KeyManagementServicePort
  1070. If (strPort = 0) Then
  1071. strPort = DefaultPort
  1072. End If
  1073. LineOut " " & GetResource("L_MsgRegisteredKmsName") & strKms & ":" & strPort
  1074. Else
  1075. strKms = objProduct.DiscoveredKeyManagementServiceMachineName
  1076. strPort = objProduct.DiscoveredKeyManagementServiceMachinePort
  1077.  
  1078. If IsNull(strKms) Or (strKms = "") Or IsNull(strPort) Or (strPort = 0) Then
  1079. LineOut " " & GetResource("L_MsgKmsFromDnsUnavailable")
  1080. Else
  1081. LineOut " " & GetResource("L_MsgKmsFromDns") & strKms & ":" & strPort
  1082. End If
  1083. End If
  1084.  
  1085. LineOut " " & GetResource("L_MsgKmsPID4") & objProduct.KeyManagementServiceProductKeyID
  1086. strOutput = Replace(GetResource("L_MsgActivationInterval"), "%INTERVAL%", iVLActivationInterval)
  1087. LineOut " " & strOutput
  1088. strOutput = Replace(GetResource("L_MsgRenewalInterval"), "%INTERVAL%", iVLRenewalInterval)
  1089. LineOut " " & strOutput
  1090.  
  1091. if (objService.KeyManagementServiceHostCaching = True) Then
  1092. LineOut " " & GetResource("L_MsgKmsHostCachingEnabled")
  1093. Else
  1094. LineOut " " & GetResource("L_MsgKmsHostCachingDisabled")
  1095. End If
  1096. End Sub
  1097.  
  1098. '
  1099. ' Display all information for /dlv and /dli
  1100. ' If you add need to access new properties through WMI you must add them to the
  1101. ' queries for service/object. Be sure to check that the object properties in DisplayAllInformation()
  1102. ' are requested for function/methods such as GetIsPrimaryWindowsSKU() and DisplayKMSClientInformation().
  1103. '
  1104. Private Sub DisplayAllInformation(strParm, bVerbose)
  1105. Dim objService, objProduct
  1106. Dim strServiceSelectClause
  1107. Dim strDescription, bKmsClient, strSLActID, bKmsServer, bTBL
  1108. Dim ls, gpMin, gpDay, displayDate
  1109. Dim strOutput
  1110. Dim bShowSkuInformation
  1111. Dim iIsPrimaryWindowsSku, bUseDefault
  1112. Dim productKeyFound
  1113.  
  1114. Dim strErr
  1115. strParm = LCase(strParm)
  1116. productKeyFound = False
  1117. strServiceSelectClause = "KeyManagementServiceListeningPort, KeyManagementServiceDnsPublishing, " & _
  1118. "KeyManagementServiceLowPriority, ClientMachineId, KeyManagementServiceHostCaching, " & _
  1119. "Version"
  1120.  
  1121. If bVerbose Then
  1122. strServiceSelectClause = "RemainingWindowsReArmCount, " & strServiceSelectClause
  1123. End If
  1124.  
  1125. set objService = GetServiceObject(strServiceSelectClause)
  1126.  
  1127. If bVerbose Then
  1128. LineOut GetResource("L_MsgServiceVersion") & objService.Version
  1129. End If
  1130.  
  1131. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", " & _
  1132. "ProductKeyID, OfflineInstallationId, " & _
  1133. "ProcessorURL, MachineURL, UseLicenseURL, ProductKeyURL, " & _
  1134. "GracePeriodRemaining, LicenseStatus, LicenseStatusReason, EvaluationEndDate, " & _
  1135. "VLRenewalInterval, VLActivationInterval, KeyManagementServiceMachine, " & _
  1136. "KeyManagementServicePort, DiscoveredKeyManagementServiceMachineName, " & _
  1137. "DiscoveredKeyManagementServiceMachinePort, KeyManagementServiceProductKeyID," & _
  1138. "TokenActivationILID, TokenActivationILVID, TokenActivationGrantNumber," & _
  1139. "TokenActivationCertificateThumbprint, TokenActivationAdditionalInfo, TrustedTime", _
  1140. EmptyWhereClause)
  1141.  
  1142. strSLActID = objProduct.ID
  1143.  
  1144. ' Display information if:
  1145. ' parm = "all" or
  1146. ' ActID = parm or
  1147. ' default to current ActID (parm = "" and IsPrimaryWindowsSKU is 1 or 2)
  1148. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  1149. bUseDefault = False
  1150. bShowSkuInformation = False
  1151.  
  1152. If (strParm = "" And ((iIsPrimaryWindowsSku = 1) Or (iIsPrimaryWindowsSku = 2))) Then
  1153. bUseDefault = True
  1154. bShowSkuInformation = True
  1155. End If
  1156.  
  1157. If (strParm = "" And (objProduct.LicenseIsAddon And objProduct.PartialProductKey <> "")) Then
  1158. bShowSkuInformation = True
  1159. End If
  1160.  
  1161. If (strParm = "all") Then
  1162. bShowSkuInformation = True
  1163. End If
  1164.  
  1165. If (strParm = LCase(strSLActID)) Then
  1166. bShowSkuInformation = True
  1167. End If
  1168.  
  1169. If (bShowSkuInformation) Then
  1170.  
  1171. strDescription = objProduct.Description
  1172.  
  1173. 'If the user didn't specify anything and we are showing the default case, warn them
  1174. ' if this can't be verified as the primary SKU
  1175. If ((bUseDefault = True) And (iIsPrimaryWindowsSku = 2)) Then
  1176. OutputIndeterminateOperationWarning(objProduct)
  1177. End IF
  1178.  
  1179. productKeyFound = True
  1180.  
  1181. LineOut ""
  1182. LineOut GetResource("L_MsgProductName") & objProduct.Name
  1183.  
  1184. LineOut GetResource("L_MsgProductDesc") & strDescription
  1185.  
  1186. If objProduct.TokenActivationAdditionalInfo <> "" Then
  1187. LineOut Replace( _
  1188. GetResource("L_MsgTkaInfoAdditionalInfo"), _
  1189. "%MOREINFO%", _
  1190. objProduct.TokenActivationAdditionalInfo _
  1191. )
  1192. End If
  1193.  
  1194. bKmsServer = IsKmsServer(strDescription)
  1195. bKmsClient = IsKmsClient(strDescription)
  1196. bTBL = IsTBL(strDescription)
  1197.  
  1198. If bVerbose Then
  1199. LineOut GetResource("L_MsgActID") & strSLActID
  1200. LineOut GetResource("L_MsgAppID") & objProduct.ApplicationID
  1201. LineOut GetResource("L_MsgPID4") & objProduct.ProductKeyID
  1202. LineOut GetResource("L_MsgInstallationID") & objProduct.OfflineInstallationId
  1203.  
  1204. If NOT bKmsClient Then
  1205. LineOut GetResource("L_MsgProcessorCertUrl") & objProduct.ProcessorURL
  1206. LineOut GetResource("L_MsgMachineCertUrl") & objProduct.MachineURL
  1207. LineOut GetResource("L_MsgUseLicenseCertUrl") & objProduct.UseLicenseURL
  1208. LineOut GetResource("L_MsgPKeyCertUrl") & objProduct.ProductKeyURL
  1209. End If
  1210. End If
  1211.  
  1212. If objProduct.PartialProductKey <> "" Then
  1213. LineOut GetResource("L_MsgPartialPKey") & objProduct.PartialProductKey
  1214. Else
  1215. LineOut GetResource("L_MsgErrorLicenseNotInUse")
  1216. End If
  1217.  
  1218. ls = objProduct.LicenseStatus
  1219.  
  1220. If ls = 0 Then
  1221. LineOut GetResource("L_MsgLicenseStatusUnlicensed_1")
  1222.  
  1223. ElseIf ls = 1 Then
  1224. LineOut GetResource("L_MsgLicenseStatusLicensed_1")
  1225. gpMin = objProduct.GracePeriodRemaining
  1226. If (gpMin <> 0) Then
  1227. gpDay = Int(gpMin / (24 * 60))
  1228. If (bTBL) Then
  1229. strOutput = Replace(GetResource("L_MsgLicenseStatusTBL_1"), "%MINUTE%", gpMin)
  1230. Else
  1231. strOutput = Replace(GetResource("L_MsgLicenseStatusVL_1"), "%MINUTE%", gpMin)
  1232. End If
  1233. strOutput = Replace(strOutput, "%DAY%", gpDay)
  1234. LineOut strOutput
  1235. End If
  1236.  
  1237. ElseIf ls = 2 Then
  1238. LineOut GetResource("L_MsgLicenseStatusInitialGrace_1")
  1239. gpMin = objProduct.GracePeriodRemaining
  1240. gpDay = Int(gpMin / (24 * 60))
  1241. strOutput = Replace(GetResource("L_MsgLicenseStatusTimeRemaining"), "%MINUTE%", gpMin)
  1242. strOutput = Replace(strOutput, "%DAY%", gpDay)
  1243. LineOut strOutput
  1244.  
  1245. ElseIf ls = 3 Then
  1246. LineOut GetResource("L_MsgLicenseStatusAdditionalGrace_1")
  1247. gpMin = objProduct.GracePeriodRemaining
  1248. gpDay = Int(gpMin / (24 * 60))
  1249. strOutput = Replace(GetResource("L_MsgLicenseStatusTimeRemaining"), "%MINUTE%", gpMin)
  1250. strOutput = Replace(strOutput, "%DAY%", gpDay)
  1251. LineOut strOutput
  1252.  
  1253. ElseIf ls = 4 Then
  1254. LineOut GetResource("L_MsgLicenseStatusNonGenuineGrace_1")
  1255. gpMin = objProduct.GracePeriodRemaining
  1256. gpDay = Int(gpMin / (24 * 60))
  1257. strOutput = Replace(GetResource("L_MsgLicenseStatusTimeRemaining"), "%MINUTE%", gpMin)
  1258. strOutput = Replace(strOutput, "%DAY%", gpDay)
  1259. LineOut strOutput
  1260.  
  1261. ElseIf ls = 5 Then
  1262. LineOut GetResource("L_MsgLicenseStatusNotification_1")
  1263. strErr = CStr(Hex(objProduct.LicenseStatusReason))
  1264. if (objProduct.LicenseStatusReason = HR_SL_E_NOT_GENUINE) Then
  1265. strOutput = Replace(GetResource("L_MsgNotificationErrorReasonNonGenuine"), "%ERRCODE%", strErr)
  1266. ElseIf (objProduct.LicenseStatusReason = HR_SL_E_GRACE_TIME_EXPIRED) Then
  1267. strOutput = Replace(GetResource("L_MsgNotificationErrorReasonExpiration"), "%ERRCODE%", strErr)
  1268. Else
  1269. strOutput = Replace(GetResource("L_MsgNotificationErrorReasonOther"), "%ERRCODE%", strErr)
  1270. End If
  1271. LineOut strOutput
  1272.  
  1273. ElseIf ls = 6 Then
  1274. LineOut GetResource("L_MsgLicenseStatusExtendedGrace_1")
  1275. gpMin = objProduct.GracePeriodRemaining
  1276. gpDay = Int(gpMin / (24 * 60))
  1277. strOutput = Replace(GetResource("L_MsgLicenseStatusTimeRemaining"), "%MINUTE%", gpMin)
  1278. strOutput = Replace(strOutput, "%DAY%", gpDay)
  1279. LineOut strOutput
  1280.  
  1281. Else
  1282. LineOut GetResource("L_MsgLicenseStatusUnknown")
  1283. End If
  1284.  
  1285. If (ls <> 0 And bVerbose) Then
  1286. Set displayDate = CreateObject("WBemScripting.SWbemDateTime")
  1287. displayDate.Value = objProduct.EvaluationEndDate
  1288. If (displayDate.GetFileTime(false) <> 0) Then
  1289. LineOut GetResource("L_MsgLicenseStatusEvalEndData") & displayDate.GetVarDate
  1290. End If
  1291. End If
  1292.  
  1293. If (bVerbose) Then
  1294.  
  1295. LineOut Replace(GetResource("L_MsgRemainingWindowsRearmCount"), "%COUNT%", objService.RemainingWindowsReArmCount)
  1296.  
  1297. Set displayDate = CreateObject("WBemScripting.SWbemDateTime")
  1298. displayDate.Value = objProduct.TrustedTime
  1299. If (displayDate.GetFileTime(false) <> 0) Then
  1300. LineOut GetResource("L_MsgCurrentTrustedTime") & displayDate.GetVarDate
  1301. End If
  1302.  
  1303. End If
  1304.  
  1305. '
  1306. ' KMS client properties
  1307. '
  1308.  
  1309. If bKmsClient Then
  1310. If IsTokenActivated(objProduct) Then
  1311. DisplayTkaClientInformation objService, objProduct
  1312. ElseIf ls <> 1 Then
  1313. LineOut GetResource("L_MsgPleaseActivateRefreshKMSInfo")
  1314. Else
  1315. DisplayKMSClientInformation objService, objProduct
  1316. End If
  1317. End If
  1318.  
  1319. If (bKmsServer Or (iIsPrimaryWindowsSku = 1) Or (iIsPrimaryWindowsSku = 2)) Then
  1320. DisplayKMSInformation objService, objProduct
  1321. End If
  1322.  
  1323. 'We should stop processing if we aren't processing All and either we were told to process a single
  1324. 'entry only or we found the primary SKU
  1325. If strParm <> "all" Then
  1326. If (strParm = LCase(strSLActID)) Then
  1327. Exit For 'no need to continue
  1328. End If
  1329. End If
  1330.  
  1331. LineOut ""
  1332. End If
  1333. Next
  1334.  
  1335. If productKeyFound = False Then
  1336. LineOut GetResource("L_MsgErrorPKey")
  1337. End If
  1338.  
  1339. End Sub
  1340.  
  1341. Private Sub InstallProductKey(strProductKey)
  1342. Dim objService, objProduct
  1343. Dim lRet, strDescription, strOutput, strVersion
  1344. Dim iIsPrimaryWindowsSku, bIsKMS
  1345.  
  1346. bIsKMS = False
  1347.  
  1348. On Error Resume Next
  1349.  
  1350. set objService = GetServiceObject("Version")
  1351. strVersion = objService.Version
  1352. objService.InstallProductKey(strProductKey)
  1353. QuitIfError()
  1354.  
  1355. ' Installing a product key could change Windows licensing state.
  1356. ' Since the service determines if it can shut down and when is the next start time
  1357. ' based on the licensing state we should reconsume the licenses here.
  1358. objService.RefreshLicenseStatus()
  1359.  
  1360. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause, PartialProductKeyNonNullWhereClause)
  1361. strDescription = objProduct.Description
  1362.  
  1363. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  1364. If (iIsPrimaryWindowsSku = 2) Then
  1365. OutputIndeterminateOperationWarning(objProduct)
  1366. End If
  1367.  
  1368. If IsKmsServer(strDescription) Then
  1369. bIsKMS = True
  1370. Exit For
  1371. End If
  1372. Next
  1373.  
  1374. If (bIsKMS = True) Then
  1375. ' Set the KMS version in the registry (64 and 32 bit versions)
  1376. lRet = SetRegistryStr(HKEY_LOCAL_MACHINE, SLKeyPath, "KeyManagementServiceVersion", strVersion)
  1377. If (lRet <> 0) Then
  1378. QuitWithError Hex(lRet)
  1379. End If
  1380.  
  1381. If ExistsRegistryKey(HKEY_LOCAL_MACHINE, SLKeyPath32) Then
  1382. lRet = SetRegistryStr(HKEY_LOCAL_MACHINE, SLKeyPath32, "KeyManagementServiceVersion", strVersion)
  1383. If (lRet <> 0) Then
  1384. QuitWithError Hex(lRet)
  1385. End If
  1386. End If
  1387. Else
  1388. ' Clear the KMS version in the registry (64 and 32 bit versions)
  1389. lRet = DeleteRegistryValue(HKEY_LOCAL_MACHINE, SLKeyPath, "KeyManagementServiceVersion")
  1390. If (lRet <> 0 And lRet <> 2 And lRet <> 5) Then
  1391. QuitWithError Hex(lRet)
  1392. End If
  1393.  
  1394. lRet = DeleteRegistryValue(HKEY_LOCAL_MACHINE, SLKeyPath32, "KeyManagementServiceVersion")
  1395. If (lRet <> 0 And lRet <> 2 And lRet <> 5) Then
  1396. QuitWithError Hex(lRet)
  1397. End If
  1398. End If
  1399.  
  1400. strOutput = Replace(GetResource("L_MsgInstalledPKey"), "%PKEY%", strProductKey)
  1401. LineOut strOutput
  1402. End Sub
  1403.  
  1404. Private Sub OutputIndeterminateOperationWarning(objProduct)
  1405. Dim strOutput
  1406.  
  1407. LineOut GetResource("L_MsgUndeterminedPrimaryKeyOperation")
  1408. strOutput = Replace(GetResource("L_MsgUndeterminedOperationFormat"), "%PRODUCTDESCRIPTION%", objProduct.Description)
  1409. strOutput = Replace(strOutput, "%PRODUCTID%", objProduct.ID)
  1410. LineOut strOutput
  1411. End Sub
  1412.  
  1413. Private Sub ClearPKeyFromRegistry()
  1414. Dim objService
  1415.  
  1416. On Error Resume Next
  1417.  
  1418. set objService = GetServiceObject("Version")
  1419. QuitIfError()
  1420.  
  1421. objService.ClearProductKeyFromRegistry()
  1422. QuitIfError()
  1423.  
  1424. LineOut GetResource("L_MsgClearedPKey")
  1425. End Sub
  1426.  
  1427. Private Sub InstallLicenseFiles (strParentDirectory, fso)
  1428. Dim file, files, folder, subFolder
  1429.  
  1430. Set folder = fso.GetFolder(strParentDirectory)
  1431. Set files = folder.Files
  1432.  
  1433. ' Install all license files in folder
  1434. For Each file In files
  1435. If Right(file.Name, 7) = ".xrm-ms" Then
  1436. InstallLicense strParentDirectory & "\" & file.Name
  1437. End If
  1438. Next
  1439.  
  1440. For Each subFolder in folder.SubFolders
  1441. InstallLicenseFiles subFolder, fso
  1442. Next
  1443. End Sub
  1444.  
  1445. Private Sub ReinstallLicenses()
  1446. Dim shell, fso, strOemFolder
  1447. Dim strSppTokensFolder, folder, subFolder
  1448. Set shell = WScript.CreateObject("WScript.Shell")
  1449. Set fso = CreateObject("Scripting.FileSystemObject")
  1450.  
  1451. strOemFolder = shell.ExpandEnvironmentStrings("%SystemRoot%") & "\system32\oem"
  1452. strSppTokensFolder = shell.ExpandEnvironmentStrings("%SystemRoot%") & "\system32\spp\tokens"
  1453.  
  1454. LineOut GetResource("L_MsgReinstallingLicenses")
  1455.  
  1456. Set folder = fso.GetFolder(strSppTokensFolder)
  1457.  
  1458. For Each subFolder in folder.SubFolders
  1459. InstallLicenseFiles subFolder, fso
  1460. Next
  1461.  
  1462. If (fso.FolderExists(strOemFolder)) Then
  1463. InstallLicenseFiles strOemFolder, fso
  1464. End If
  1465.  
  1466. LineOut GetResource("L_MsgLicensesReinstalled")
  1467. End Sub
  1468.  
  1469. Private Sub ReArmWindows
  1470. Dim objService
  1471.  
  1472. set objService = GetServiceObject("Version")
  1473. On Error Resume Next
  1474.  
  1475. objService.ReArmWindows()
  1476. QuitIfError()
  1477.  
  1478. LineOut GetResource("L_MsgRearm_1")
  1479. LineOut GetResource("L_MsgRearm_2")
  1480. End Sub
  1481.  
  1482. Private Sub ExpirationDatime(strActivationID)
  1483. Dim objProduct
  1484. Dim strSLActID, ls, graceRemaining, strEnds
  1485. Dim strOutput
  1486. Dim strDescription, bTBL
  1487. Dim iIsPrimaryWindowsSku
  1488. Dim bFound
  1489.  
  1490. strActivationID = LCase(strActivationID)
  1491.  
  1492. bFound = False
  1493.  
  1494. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause & ", LicenseStatus, GracePeriodRemaining", EmptyWhereClause)
  1495. If ((strActivationID = "" And LCase(objProduct.ApplicationId) = WindowsAppId) Or LCase(objProduct.ID) = strActivationID) And (objProduct.PartialProductKey <> "") Then
  1496. strSLActID = objProduct.ID
  1497. ls = objProduct.LicenseStatus
  1498. graceRemaining = objProduct.GracePeriodRemaining
  1499. strEnds = DateAdd("n", graceRemaining, Now)
  1500.  
  1501. bFound = True
  1502.  
  1503. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  1504. If (strActivationID = "") And (iIsPrimaryWindowsSku = 2) Then
  1505. OutputIndeterminateOperationWarning(objProduct)
  1506. End If
  1507.  
  1508. strOutput = ""
  1509.  
  1510. If ls = 0 Then
  1511. strOutput = GetResource("L_MsgLicenseStatusUnlicensed")
  1512.  
  1513. ElseIf ls = 1 Then
  1514. If graceRemaining <> 0 Then
  1515.  
  1516. strDescription = objProduct.Description
  1517.  
  1518. bTBL = IsTBL(strDescription)
  1519.  
  1520. If bTBL Then
  1521. strOutput = Replace(GetResource("L_MsgLicenseStatusTBL"), "%ENDDATE%", strEnds)
  1522. Else
  1523. strOutput = Replace(GetResource("L_MsgLicenseStatusVL"), "%ENDDATE%", strEnds)
  1524. End If
  1525. Else
  1526. strOutput = GetResource("L_MsgLicenseStatusLicensed")
  1527. End If
  1528.  
  1529. ElseIf ls = 2 Then
  1530. strOutput = Replace(GetResource("L_MsgLicenseStatusInitialGrace"), "%ENDDATE%", strEnds)
  1531. ElseIf ls = 3 Then
  1532. strOutput = Replace(GetResource("L_MsgLicenseStatusAdditionalGrace"), "%ENDDATE%", strEnds)
  1533. ElseIf ls = 4 Then
  1534. strOutput = Replace(GetResource("L_MsgLicenseStatusNonGenuineGrace"), "%ENDDATE%", strEnds)
  1535. ElseIf ls = 5 Then
  1536. strOutput = GetResource("L_MsgLicenseStatusNotification")
  1537. ElseIf ls = 6 Then
  1538. strOutput = Replace(GetResource("L_MsgLicenseStatusExtendedGrace"), "%ENDDATE%", strEnds)
  1539. End If
  1540.  
  1541. If strOutput <> "" Then
  1542. LineOut objProduct.Name & ":"
  1543. Lineout " " & strOutput
  1544. End If
  1545.  
  1546. End If
  1547. Next
  1548.  
  1549. If True <> bFound Then
  1550. LineOut GetResource("L_MsgErrorPKey")
  1551. End If
  1552. End Sub
  1553.  
  1554. ' volume license service/client management
  1555.  
  1556.  
  1557. Private Sub QuitIfErrorRestoreKmsName(obj, strKmsName)
  1558. Dim errNum
  1559.  
  1560. If Err.Number <> 0 Then
  1561. errNum = Err.Number
  1562.  
  1563. If strKmsName = "" Then
  1564. obj.ClearKeyManagementServiceMachine()
  1565. Else
  1566. obj.SetKeyManagementServiceMachine(strKmsName)
  1567. End If
  1568.  
  1569. ShowErrorNum GetResource("L_MsgErrorText_8"), CStr(Hex(errNum))
  1570. ExitScript errNum
  1571. End If
  1572. End Sub
  1573.  
  1574. Private Sub SetKmsMachineName(strKmsNamePort, strActivationID)
  1575. Dim objService, objProduct
  1576. Dim nColon, strKmsName, strKmsNamePrev, strKmsPort, lRet, strOutput, nBracketEnd
  1577. Dim nKmsPort
  1578. Dim activationIDFound
  1579.  
  1580. nBracketEnd = InStr(StrKmsNamePort, "]")
  1581. If InStr(strKmsNamePort, "[") = 1 And nBracketEnd > 1 Then
  1582. ' IPV6 Address
  1583. If Len(StrKmsNamePort) = nBracketEnd Then
  1584. 'No Port Number
  1585. strKmsName = strKmsNamePort
  1586. strKmsPort = ""
  1587. Else
  1588. strKmsName = Left(strKmsNamePort, nBracketEnd)
  1589. strKmsPort = Right(strKmsNamePort, Len(strKmsNamePort) - nBracketEnd - 1)
  1590. End If
  1591. Else
  1592. ' IPV4 Address
  1593. nColon = InStr(1, strKmsNamePort, ":")
  1594. If nColon <> 0 Then
  1595. strKmsName = Left(strKmsNamePort, nColon - 1)
  1596. strKmsPort = Right(strKmsNamePort, Len(strKmsNamePort) - nColon)
  1597. Else
  1598. strKmsName = strKmsNamePort
  1599. strKmsPort = ""
  1600. End If
  1601. End If
  1602.  
  1603. strActivationID = LCase(strActivationID)
  1604.  
  1605. set objService = GetServiceObject("Version, KeyManagementServiceMachine")
  1606. On Error Resume Next
  1607.  
  1608. If (strActivationID = "") Then
  1609. strKmsNamePrev = objService.KeyManagementServiceMachine
  1610.  
  1611. If strKmsName <> "" Then
  1612. objService.SetKeyManagementServiceMachine(strKmsName)
  1613. QuitIfError()
  1614. End If
  1615.  
  1616. If strKmsPort <> "" Then
  1617. nKmsPort = CLng(strKmsPort)
  1618. QuitIfErrorRestoreKmsName objService, strKmsNamePrev
  1619. objService.SetKeyManagementServicePort(nKmsPort)
  1620. QuitIfErrorRestoreKmsName objService, strKmsNamePrev
  1621. Else
  1622. objService.ClearKeyManagementServicePort()
  1623. QuitIfErrorRestoreKmsName objService, strKmsNamePrev
  1624. End If
  1625. Else
  1626. activationIDFound = False
  1627.  
  1628. For Each objProduct in GetProductCollection("ID, KeyManagementServiceMachine", EmptyWhereClause)
  1629. If (LCase(objProduct.ID) = strActivationID) Then
  1630.  
  1631. strKmsNamePrev = objProduct.KeyManagementServiceMachine
  1632.  
  1633. If strKmsName <> "" Then
  1634. objProduct.SetKeyManagementServiceMachine(strKmsName)
  1635. QuitIfError()
  1636. End If
  1637.  
  1638. If strKmsPort <> "" Then
  1639. nKmsPort = CLng(strKmsPort)
  1640. QuitIfErrorRestoreKmsName objProduct, strKmsNamePrev
  1641. objProduct.SetKeyManagementServicePort(nKmsPort)
  1642. QuitIfErrorRestoreKmsName objProduct, strKmsNamePrev
  1643. Else
  1644. objProduct.ClearKeyManagementServicePort()
  1645. QuitIfErrorRestoreKmsName objProduct, strKmsNamePrev
  1646. End If
  1647.  
  1648. activationIDFound = True
  1649. Exit For
  1650. End If
  1651. Next
  1652.  
  1653. if activationIDFound = False Then
  1654. strOutput = Replace(GetResource("L_MsgErrorActivationID"), "%ActID%", strActivationID)
  1655. Lineout strOutput
  1656. End If
  1657. End If
  1658.  
  1659. QuitIfError()
  1660.  
  1661. If (strActivationID = "") Or (activationIDFound = True) Then
  1662. strOutput = Replace(GetResource("L_MsgKmsNameSet"), "%KMS%", strKmsNamePort)
  1663. LineOut strOutput
  1664. End If
  1665. End Sub
  1666.  
  1667. Private Sub SetHostCachingDisable(boolHostCaching)
  1668. Dim objService
  1669.  
  1670. On Error Resume Next
  1671.  
  1672. set objService = GetServiceObject("Version")
  1673. QuitIfError()
  1674.  
  1675. objService.DisableKeyManagementServiceHostCaching(boolHostCaching)
  1676. QuitIfError()
  1677.  
  1678. If boolHostCaching Then
  1679. LineOut GetResource("L_MsgKmsHostCachingDisabled")
  1680. Else
  1681. LineOut GetResource("L_MsgKmsHostCachingEnabled")
  1682. End If
  1683.  
  1684. End Sub
  1685.  
  1686. Private Sub ClearKms(strActivationID)
  1687. Dim objService, objProduct
  1688. Dim lRet
  1689. Dim activationIDFound, strOutput
  1690.  
  1691. strActivationID = LCase(strActivationID)
  1692.  
  1693. On Error Resume Next
  1694.  
  1695. set objService = GetServiceObject("Version")
  1696. QuitIfError()
  1697.  
  1698. If (strActivationID = "") Then
  1699. objService.ClearKeyManagementServiceMachine()
  1700. objService.ClearKeyManagementServicePort()
  1701. Else
  1702. activationIDFound = False
  1703.  
  1704. For Each objProduct in GetProductCollection("ID", EmptyWhereClause)
  1705. If (LCase(objProduct.ID) = strActivationID) Then
  1706. objProduct.ClearKeyManagementServiceMachine()
  1707. objProduct.ClearKeyManagementServicePort()
  1708.  
  1709. activationIDFound = True
  1710. Exit For
  1711. End If
  1712. Next
  1713.  
  1714. if activationIDFound = False Then
  1715. strOutput = Replace(GetResource("L_MsgErrorActivationID"), "%ActID%", strActivationID)
  1716. Lineout strOutput
  1717. End If
  1718. End If
  1719.  
  1720. If (strActivationID = "") Or (activationIDFound = True) Then
  1721. LineOut GetResource("L_MsgKmsNameCleared")
  1722. End If
  1723. End Sub
  1724.  
  1725. Private Sub SetActivationInterval(intInterval)
  1726. Dim objService, objProduct
  1727. Dim kmsFlag, strOutput
  1728.  
  1729. If (intInterval < 0) Then
  1730. LineOut GetResource("L_MsgInvalidDataError")
  1731. Exit Sub
  1732. End If
  1733.  
  1734. On Error Resume Next
  1735.  
  1736. set objService = GetServiceObject("Version")
  1737. QuitIfError()
  1738.  
  1739. For Each objProduct in GetProductCollection("ID, IsKeyManagementServiceMachine", PartialProductKeyNonNullWhereClause)
  1740. kmsFlag = objProduct.IsKeyManagementServiceMachine
  1741. If kmsFlag = 1 Then
  1742. objService.SetVLActivationInterval(intInterval)
  1743. QuitIfError()
  1744. strOutput = Replace(GetResource("L_MsgActivationSet"), "%ACTIVATION%", intInterval)
  1745. LineOut strOutput
  1746. LineOut GetResource("L_MsgWarningKmsReboot")
  1747.  
  1748. Exit For
  1749. End If
  1750. Next
  1751.  
  1752. If kmsFlag <> 1 Then
  1753. LineOut GetResource("L_MsgWarningActivation")
  1754. End If
  1755. End Sub
  1756.  
  1757. Private Sub SetRenewalInterval(intInterval)
  1758. Dim objService, objProduct
  1759. Dim kmsFlag, strOutput
  1760.  
  1761. If (intInterval < 0) Then
  1762. LineOut GetResource("L_MsgInvalidDataError")
  1763. Exit Sub
  1764. End If
  1765.  
  1766. On Error Resume Next
  1767.  
  1768. set objService = GetServiceObject("Version")
  1769. QuitIfError()
  1770.  
  1771. For Each objProduct in GetProductCollection("ID, IsKeyManagementServiceMachine", PartialProductKeyNonNullWhereClause)
  1772. kmsFlag = objProduct.IsKeyManagementServiceMachine
  1773. If kmsFlag Then
  1774. objService.SetVLRenewalInterval(intInterval)
  1775. QuitIfError()
  1776. strOutput = Replace(GetResource("L_MsgRenewalSet"), "%RENEWAL%", intInterval)
  1777. LineOut strOutput
  1778. LineOut GetResource("L_MsgWarningKmsReboot")
  1779.  
  1780. Exit For
  1781. End If
  1782. Next
  1783.  
  1784. If kmsFlag <> 1 Then
  1785. LineOut GetResource("L_MsgWarningRenewal")
  1786. End If
  1787. End Sub
  1788.  
  1789. Private Sub SetKmsListenPort(strPort)
  1790. Dim objService, objProduct
  1791. Dim kmsFlag, lRet, strOutput
  1792. Dim nPort
  1793.  
  1794. On Error Resume Next
  1795.  
  1796. set objService = GetServiceObject("Version")
  1797. QuitIfError()
  1798.  
  1799. For Each objProduct in GetProductCollection("ID, IsKeyManagementServiceMachine", PartialProductKeyNonNullWhereClause)
  1800. kmsFlag = objProduct.IsKeyManagementServiceMachine
  1801. If kmsFlag Then
  1802. nPort = CLng(strPort)
  1803. objService.SetKeyManagementServiceListeningPort(nPort)
  1804. QuitIfError()
  1805. strOutput = Replace(GetResource("L_MsgKmsPortSet"), "%PORT%", strPort)
  1806. LineOut strOutput
  1807. LineOut GetResource("L_MsgWarningKmsReboot")
  1808.  
  1809. Exit For
  1810. End If
  1811. Next
  1812.  
  1813. If kmsFlag <> 1 Then
  1814. LineOut GetResource("L_MsgWarningKmsPort")
  1815. End If
  1816. End Sub
  1817.  
  1818. Private Sub SetDnsPublishingDisabled(bool)
  1819. Dim objService, objProduct
  1820. Dim kmsFlag, lRet, dwValue
  1821.  
  1822. On Error Resume Next
  1823.  
  1824. set objService = GetServiceObject("Version")
  1825. QuitIfError()
  1826.  
  1827. For Each objProduct in GetProductCollection("ID, IsKeyManagementServiceMachine", PartialProductKeyNonNullWhereClause)
  1828. kmsFlag = objProduct.IsKeyManagementServiceMachine
  1829. If kmsFlag Then
  1830. objService.DisableKeyManagementServiceDnsPublishing(bool)
  1831. QuitIfError()
  1832.  
  1833. If bool Then
  1834. LineOut GetResource("L_MsgKmsDnsPublishingDisabled")
  1835. Else
  1836. LineOut GetResource("L_MsgKmsDnsPublishingEnabled")
  1837. End If
  1838. LineOut GetResource("L_MsgWarningKmsReboot")
  1839.  
  1840. Exit For
  1841. End If
  1842. Next
  1843.  
  1844. If kmsFlag <> 1 Then
  1845. LineOut GetResource("L_MsgKmsDnsPublishingWarning")
  1846. End If
  1847. End Sub
  1848.  
  1849. Private Sub SetKmsLowPriority(bool)
  1850. Dim objService, objProduct
  1851. Dim kmsFlag, lRet, dwValue
  1852.  
  1853. On Error Resume Next
  1854.  
  1855. set objService = GetServiceObject("Version")
  1856. QuitIfError()
  1857.  
  1858. For Each objProduct in GetProductCollection("ID, IsKeyManagementServiceMachine", PartialProductKeyNonNullWhereClause)
  1859. kmsFlag = objProduct.IsKeyManagementServiceMachine
  1860. If kmsFlag Then
  1861. objService.EnableKeyManagementServiceLowPriority(bool)
  1862. QuitIfError()
  1863.  
  1864. If bool Then
  1865. LineOut GetResource("L_MsgKmsPriSetToLow")
  1866. Else
  1867. LineOut GetResource("L_MsgKmsPriSetToNormal")
  1868. End If
  1869. LineOut GetResource("L_MsgWarningKmsReboot")
  1870. End If
  1871.  
  1872. Exit For
  1873. Next
  1874.  
  1875.  
  1876. If kmsFlag <> 1 Then
  1877. LineOut GetResource("L_MsgWarningKmsPri")
  1878. End If
  1879. End Sub
  1880.  
  1881. ''
  1882. '' Token-based Activation Commands
  1883. ''
  1884.  
  1885. Private Function IsTokenActivated(objProduct)
  1886.  
  1887. Dim nILVID
  1888.  
  1889. On Error Resume Next
  1890.  
  1891. nILVID = objProduct.TokenActivationILVID
  1892.  
  1893. IsTokenActivated = ((Err.Number = 0) And (nILVID <> &HFFFFFFFF))
  1894.  
  1895. End Function
  1896.  
  1897.  
  1898. Private Sub TkaListILs
  1899. Dim objLicense
  1900. Dim strHeader
  1901. Dim strError
  1902. Dim strGuids
  1903. Dim arrGuids
  1904. Dim nListed
  1905.  
  1906. Dim objWmiDate
  1907.  
  1908. LineOut GetResource("L_MsgTkaLicenses")
  1909. LineOut ""
  1910.  
  1911. Set objWmiDate = CreateObject("WBemScripting.SWbemDateTime")
  1912.  
  1913. nListed = 0
  1914. For Each objLicense in g_objWMIService.InstancesOf(TkaLicenseClass)
  1915.  
  1916. strHeader = GetResource("L_MsgTkaLicenseHeader")
  1917. strHeader = Replace(strHeader, "%ILID%" , objLicense.ILID )
  1918. strHeader = Replace(strHeader, "%ILVID%", objLicense.ILVID)
  1919. LineOut strHeader
  1920.  
  1921. LineOut " " & Replace(GetResource("L_MsgTkaLicenseILID"), "%ILID%", objLicense.ILID)
  1922. LineOut " " & Replace(GetResource("L_MsgTkaLicenseILVID"), "%ILVID%", objLicense.ILVID)
  1923.  
  1924. If Not IsNull(objLicense.ExpirationDate) Then
  1925.  
  1926. objWmiDate.Value = objLicense.ExpirationDate
  1927.  
  1928. If (objWmiDate.GetFileTime(false) <> 0) Then
  1929. LineOut " " & Replace(GetResource("L_MsgTkaLicenseExpiration"), "%TODATE%", objWmiDate.GetVarDate)
  1930. End If
  1931.  
  1932. End If
  1933.  
  1934. If Not IsNull(objLicense.AdditionalInfo) Then
  1935. LineOut " " & Replace(GetResource("L_MsgTkaLicenseAdditionalInfo"), "%MOREINFO%", objLicense.AdditionalInfo)
  1936. End If
  1937.  
  1938. If Not IsNull(objLicense.AuthorizationStatus) And _
  1939. objLicense.AuthorizationStatus <> 0 _
  1940. Then
  1941. strError = CStr(Hex(objLicense.AuthorizationStatus))
  1942. LineOut " " & Replace(GetResource("L_MsgTkaLicenseAuthZStatus"), "%ERRCODE%", strError)
  1943. Else
  1944. LineOut " " & Replace(GetResource("L_MsgTkaLicenseDescr"), "%DESC%", objLicense.Description)
  1945. End If
  1946.  
  1947. LineOut ""
  1948. nListed = nListed + 1
  1949. Next
  1950.  
  1951. if 0 = nListed Then
  1952. LineOut GetResource("L_MsgTkaLicenseNone")
  1953. End If
  1954. End Sub
  1955.  
  1956.  
  1957. Private Sub TkaRemoveIL(strILID, strILVID)
  1958. Dim objLicense
  1959. Dim strMsg
  1960. Dim nRemoved
  1961.  
  1962. Dim nILVID
  1963.  
  1964. On Error Resume Next
  1965. nILVID = CInt(strILVID)
  1966. QuitIfError()
  1967.  
  1968. LineOut GetResource("L_MsgTkaRemoving")
  1969. LineOut ""
  1970.  
  1971. nRemoved = 0
  1972. For Each objLicense in g_objWMIService.InstancesOf(TkaLicenseClass)
  1973. If strILID = objLicense.ILID And nILVID = objLicense.ILVID Then
  1974. strMsg = GetResource("L_MsgTkaRemovedItem")
  1975. strMsg = Replace(strMsg, "%SLID%", objLicense.ID)
  1976.  
  1977. On Error Resume Next
  1978. objLicense.Uninstall
  1979. QuitIfError()
  1980. LineOut strMsg
  1981. nRemoved = nRemoved + 1
  1982. End If
  1983. Next
  1984.  
  1985. If nRemoved = 0 Then
  1986. LineOut GetResource("L_MsgTkaRemovedNone")
  1987. End If
  1988. End Sub
  1989.  
  1990.  
  1991. Private Sub TkaSetTokenActivationOnly(bTao)
  1992. Dim objService
  1993.  
  1994. On Error Resume Next
  1995.  
  1996. set objService = GetServiceObject("Version")
  1997. QuitIfError()
  1998.  
  1999. objService.DisableKeyManagementServiceActivation(bTao)
  2000. QuitIfError()
  2001.  
  2002. If bTao Then
  2003. LineOut GetResource("L_MsgTkaTaoSet")
  2004. Else
  2005. LineOut GetResource("L_MsgTkaTaoClear")
  2006. End If
  2007.  
  2008. End Sub
  2009.  
  2010. Private Sub TkaListCerts
  2011. Dim objProduct
  2012. Dim objSigner
  2013. Dim iRet
  2014. Dim arrGrants()
  2015. Dim arrThumbprints
  2016. Dim strThumbprint
  2017.  
  2018. On Error Resume Next
  2019.  
  2020. Set objSigner = TkaGetSigner()
  2021. Set objProduct = TkaGetProduct()
  2022.  
  2023. iRet = objProduct.GetTokenActivationGrants(arrGrants)
  2024. QuitIfError()
  2025.  
  2026. arrThumbprints = objSigner.GetCertificateThumbprints(arrGrants)
  2027. QuitIfError()
  2028.  
  2029. For Each strThumbprint in arrThumbprints
  2030. TkaPrintCertificate strThumbprint
  2031. Next
  2032. End Sub
  2033.  
  2034.  
  2035. Private Sub TkaActivate(strThumbprint, strPin)
  2036. Dim objService
  2037. Dim objProduct
  2038. Dim objSigner
  2039. Dim iRet
  2040.  
  2041. Dim strChallenge
  2042.  
  2043. Dim strAuthInfo1
  2044. Dim strAuthInfo2
  2045.  
  2046. Set objSigner = TkaGetSigner()
  2047. Set objProduct = TkaGetProduct()
  2048. Set objService = TkaGetService()
  2049.  
  2050. DisplayActivatingSku objProduct
  2051.  
  2052. On Error Resume Next
  2053.  
  2054. iRet = objProduct.GenerateTokenActivationChallenge(strChallenge)
  2055. QuitIfError()
  2056.  
  2057. strAuthInfo1 = objSigner.Sign(strChallenge, strThumbprint, strPin, strAuthInfo2)
  2058. QuitIfError()
  2059.  
  2060. iRet = objProduct.DepositTokenActivationResponse(strChallenge, strAuthInfo1, strAuthInfo2)
  2061. QuitIfError()
  2062.  
  2063. objService.RefreshLicenseStatus()
  2064. Err.Number = 0
  2065.  
  2066. objProduct.refresh_
  2067. DisplayActivatedStatus objProduct
  2068. QuitIfError()
  2069.  
  2070. End Sub
  2071.  
  2072.  
  2073. Private Function TkaGetService()
  2074.  
  2075. Set TkaGetService = GetServiceObject("Version")
  2076.  
  2077. End Function
  2078.  
  2079.  
  2080. Private Function TkaGetProduct()
  2081.  
  2082. Dim objWinProductsWithPKeyInstalled
  2083. Dim objProduct
  2084.  
  2085. On Error Resume Next
  2086.  
  2087. Set TkaGetProduct = Nothing
  2088.  
  2089. Set TkaGetProduct = GetProductObject( _
  2090. "ID, Name, ApplicationId, PartialProductKey, Description, LicenseIsAddon ", _
  2091. "ApplicationId = '" & WindowsAppId & "' " &_
  2092. "AND PartialProductKey <> NULL " & _
  2093. "AND LicenseIsAddon = FALSE" _
  2094. )
  2095. QuitIfError()
  2096.  
  2097. End Function
  2098.  
  2099. Private Function TkaGetSigner()
  2100.  
  2101. On Error Resume Next
  2102. Set TkaGetSigner = WScript.CreateObject("SPPWMI.SppWmiTokenActivationSigner")
  2103. QuitIfError()
  2104.  
  2105. End Function
  2106.  
  2107. Private Sub TkaPrintCertificate(strThumbprint)
  2108. Dim arrParams
  2109.  
  2110. arrParams = Split(strThumbprint, "|")
  2111.  
  2112. LineOut ""
  2113. LineOut Replace(GetResource("L_MsgTkaCertThumbprint"), "%THUMBPRINT%", arrParams(0))
  2114. LineOut Replace(GetResource("L_MsgTkaCertSubject" ), "%SUBJECT%" , arrParams(1))
  2115. LineOut Replace(GetResource("L_MsgTkaCertIssuer" ), "%ISSUER%" , arrParams(2))
  2116. LineOut Replace(GetResource("L_MsgTkaCertValidFrom" ), "%FROMDATE%" , FormatDateTime(CDate(arrParams(3)), vbShortDate))
  2117. LineOut Replace(GetResource("L_MsgTkaCertValidTo" ), "%TODATE%" , FormatDateTime(CDate(arrParams(4)), vbShortDate))
  2118. End Sub
  2119.  
  2120. ' other generic options/helpers
  2121.  
  2122. Private Sub LineOut(str)
  2123. g_EchoString = g_EchoString & str & vbNewLine
  2124. End Sub
  2125.  
  2126. Private Sub LineFlush(str)
  2127. WScript.Echo g_EchoString & str
  2128. g_EchoString = ""
  2129. End Sub
  2130.  
  2131. Private Sub ExitScript(retval)
  2132. if (g_EchoString <> "") Then
  2133. WScript.Echo g_EchoString
  2134. End If
  2135. WScript.Quit retval
  2136. End Sub
  2137.  
  2138. Private Sub InstallLicense(licFile)
  2139. Dim objService
  2140. Dim LicenseData
  2141. Dim strOutput
  2142.  
  2143. On Error Resume Next
  2144. LicenseData = ReadAllTextFile(licFile)
  2145. QuitIfError()
  2146. set objService = GetServiceObject("Version")
  2147. QuitIfError()
  2148.  
  2149. objService.InstallLicense(LicenseData)
  2150. QuitIfError()
  2151.  
  2152. strOutput = Replace(GetResource("L_MsgLicenseFile"), "%LICENSEFILE%", licFile)
  2153. LineOut strOutput
  2154. LineOut ""
  2155. End Sub
  2156.  
  2157.  
  2158. ' Returns the encoding for a givven file.
  2159. ' Possible return values: ascii, unicode, unicodeFFFE (big-endian), utf-8
  2160. Function GetFileEncoding(strFileName)
  2161. Dim strData
  2162. Dim strEncoding
  2163. Dim oStream
  2164.  
  2165. Set oStream = CreateObject("ADODB.Stream")
  2166.  
  2167. oStream.Type = 1 'adTypeBinary
  2168. oStream.Open
  2169. oStream.LoadFromFile(strFileName)
  2170.  
  2171. ' Default encoding is ascii
  2172. strEncoding = "ascii"
  2173.  
  2174. strData = BinaryToString(oStream.Read(2))
  2175.  
  2176. ' Check for little endian (x86) unicode preamble
  2177. If (Len(strData) = 2) and strData = (Chr(255) + Chr(254)) Then
  2178. strEncoding = "unicode"
  2179. Else
  2180. oStream.Position = 0
  2181. strData = BinaryToString(oStream.Read(3))
  2182.  
  2183. ' Check for utf-8 preamble
  2184. If (Len(strData) >= 3) and strData = (Chr(239) + Chr(187) + Chr(191)) Then
  2185. strEncoding = "utf-8"
  2186. End If
  2187. End If
  2188.  
  2189. oStream.Close
  2190.  
  2191. GetFileEncoding = strEncoding
  2192. End Function
  2193.  
  2194. ' Converts binary data (VT_UI1 | VT_ARRAY) to a string (BSTR)
  2195. Function BinaryToString(dataBinary)
  2196. Dim i
  2197. Dim str
  2198.  
  2199. For i = 1 To LenB(dataBinary)
  2200. str = str & Chr(AscB(MidB(dataBinary, i, 1)))
  2201. Next
  2202.  
  2203. BinaryToString = str
  2204. End Function
  2205.  
  2206. ' Returns string containing the whole text file data.
  2207. ' Supports ascii, unicode (little-endian) and utf-8 encoding.
  2208. Function ReadAllTextFile(strFileName)
  2209. Dim strData
  2210. Dim oStream
  2211.  
  2212. Set oStream = CreateObject("ADODB.Stream")
  2213.  
  2214. oStream.Type = 2 'adTypeText
  2215. oStream.Open
  2216. oStream.Charset = GetFileEncoding(strFileName)
  2217. oStream.LoadFromFile(strFileName)
  2218.  
  2219. strData = oStream.ReadText(-1) 'adReadAll
  2220.  
  2221. oStream.Close
  2222.  
  2223. ReadAllTextFile = strData
  2224. End Function
  2225.  
  2226. Private Function HandleOptionParam(cParam, mustProvide, opt, param)
  2227. Dim strOutput
  2228.  
  2229. HandleOptionParam = True
  2230. If WScript.Arguments.Count <= cParam Then
  2231. HandleOptionParam = False
  2232. If mustProvide Then
  2233. LineOut ""
  2234. strOutput = Replace(GetResource("L_MsgErrorText_9"), "%OPTION%", opt)
  2235. strOutput = Replace(strOutput, "%PARAM%", param)
  2236. LineOut strOutput
  2237. Call DisplayUsage()
  2238. End If
  2239. End If
  2240. End Function
  2241.  
  2242. Private Sub ShowErrorNum(strMessage, strErrNum)
  2243. Dim strOutput
  2244. Dim strErrText
  2245.  
  2246. strErrText = GetResource("L_MsgError_" & strErrNum)
  2247. if (strErrText = "") Then
  2248. strOutput = Replace(GetResource("L_MsgErrorText_6"), "%ERRCODE%", strErrNum)
  2249. LineOut strOutput
  2250. End If
  2251.  
  2252. LineOut strMessage & "0x" & strErrNum & " " & strErrText
  2253. End Sub
  2254.  
  2255. Private Sub QuitIfError()
  2256. If Err.Number <> 0 Then
  2257. ShowErrorNum GetResource("L_MsgErrorText_8"), Hex(Err.Number)
  2258. ExitScript Err.Number
  2259. End If
  2260. End Sub
  2261.  
  2262. Private Sub QuitWithError(errNum)
  2263. ShowErrorNum GetResource("L_MsgErrorText_8"), CStr(errNum)
  2264. ExitScript errNum
  2265. End Sub
  2266.  
  2267. Private Function booleanConnect()
  2268.  
  2269. On Error Resume Next
  2270.  
  2271. Dim objLocator, strOutput
  2272. Dim objServer, objService
  2273. Dim strErr, strVersion
  2274.  
  2275. booleanConnect = True 'There is no error.
  2276.  
  2277. 'If this is the local computer, set everything and return immediately
  2278. If g_strComputer = "." Then
  2279. Set g_objWMIService = GetObject("winmgmts:\\" & g_strComputer & "\root\cimv2")
  2280. Set g_objRegistry = GetObject("winmgmts:\\" & g_strComputer & "\root\default:StdRegProv")
  2281.  
  2282. If Not g_serviceConnected Then
  2283. g_serviceConnected = True
  2284. End If
  2285. Exit Function
  2286. End If
  2287.  
  2288. 'Otherwise, establish the remote object connections
  2289.  
  2290. ' Create Locator object to connect to remote CIM object manager
  2291. Set objLocator = CreateObject("WbemScripting.SWbemLocator")
  2292. strErr = CStr(Hex(Err.Number))
  2293. If Err.Number <> 0 Then
  2294. strOutput = Replace(GetResource("L_MsgErrorWMI"), "%ERRCODE%", strErr)
  2295. LineOut strOutput
  2296. If Err.Description <> "" Then
  2297. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2298. End If
  2299. Err.Clear
  2300. booleanConnect = False 'An error occurred
  2301. Exit Function
  2302. End If
  2303.  
  2304. ' Connect to the namespace which is either local or remote
  2305. Set g_objWMIService = objLocator.ConnectServer (g_strComputer, "\root\cimv2", g_strUserName, g_strPassword)
  2306. strErr = CStr(Hex(Err.Number))
  2307. If Err.Number <> 0 Then
  2308. strOutput = Replace(GetResource("L_MsgErrorConnection"), "%ERRCODE%", strErr)
  2309. strOutput = Replace(strOutput, "%COMPUTERNAME%", g_strComputer)
  2310. LineOut strOutput
  2311. If Err.Description <> "" Then
  2312. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2313. End If
  2314. Err.Clear
  2315. booleanConnect = False 'An error occurred
  2316. Exit Function
  2317. End If
  2318.  
  2319. g_objWMIService.Security_.impersonationlevel = wbemImpersonationLevelImpersonate
  2320. strErr = CStr(Hex(Err.Number))
  2321. If Err.Number <> 0 Then
  2322. strOutput = Replace(GetResource("L_MsgErrorImpersonation"), "%ERRCODE%", strErr)
  2323. LineOut strOutput
  2324. If Err.Description <> "" Then
  2325. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2326. End If
  2327. Err.Clear
  2328. booleanConnect = False 'An error occurred
  2329. Exit Function
  2330. End If
  2331.  
  2332. g_objWMIService.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy
  2333. strErr = CStr(Hex(Err.Number))
  2334. If Err.Number <> 0 Then
  2335. strOutput = Replace(GetResource("L_MsgErrorAuthenticationLevel"), "%ERRCODE%", strErr)
  2336. LineOut strOutput
  2337. If Err.Description <> "" Then
  2338. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2339. End If
  2340. Err.Clear
  2341. booleanConnect = False 'An error occurred
  2342. Exit Function
  2343. End If
  2344.  
  2345. ' Get the SPP service version on the remote machine
  2346. set objService = GetServiceObject("Version")
  2347. strVersion = objService.Version
  2348.  
  2349. ' The Windows 7 version of SLMgr.vbs does not support remote connections to Vista/WS08 machines
  2350. if (Not IsNull(strVersion)) Then
  2351. strVersion = Left(strVersion, 3)
  2352. If (strVersion = "6.0") Then
  2353. LineOut GetResource("L_MsgRemoteWmiVersionMismatch")
  2354. booleanConnect = False
  2355. Exit Function
  2356. End If
  2357. End If
  2358.  
  2359. Set objServer = objLocator.ConnectServer(g_strComputer, "\root\default:StdRegProv", g_strUserName, g_strPassword)
  2360. strErr = CStr(Hex(Err.Number))
  2361. If Err.Number <> 0 Then
  2362. strOutput = Replace(GetResource("L_MsgErrorConnectionRegistry"), "%ERRCODE%", strErr)
  2363. strOutput = Replace(strOutput, "%COMPUTERNAME%", g_strComputer)
  2364. LineOut strOutput
  2365. If Err.Description <> "" Then
  2366. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2367. End If
  2368. Err.Clear
  2369. booleanConnect = False 'An error occurred
  2370. Exit Function
  2371. End If
  2372.  
  2373. objServer.Security_.ImpersonationLevel = 3
  2374. Set g_objRegistry = objServer.Get("StdRegProv")
  2375. strErr = CStr(Hex(Err.Number))
  2376. If Err.Number <> 0 Then
  2377. strOutput = Replace(GetResource("L_MsgErrorConnectionRegistry"), "%ERRCODE%", strErr)
  2378. strOutput = Replace(strOutput, "%COMPUTERNAME%", g_strComputer)
  2379. LineOut strOutput
  2380. If Err.Description <> "" Then
  2381. LineOut GetResource("L_MsgErrorDescription") & Err.Description & "."
  2382. End If
  2383. Err.Clear
  2384. booleanConnect = False 'An error occurred
  2385. Exit Function
  2386. End If
  2387.  
  2388. If Not g_serviceConnected Then
  2389. g_serviceConnected = True
  2390. End If
  2391. End Function
  2392.  
  2393. Function GetServiceObject(strQuery)
  2394. Dim objService
  2395. Dim colServices
  2396.  
  2397. On Error Resume Next
  2398.  
  2399. Set colServices = g_objWMIService.ExecQuery("SELECT " & strQuery & " FROM " & ServiceClass)
  2400. QuitIfError()
  2401.  
  2402. For each objService in colServices
  2403. QuitIfError()
  2404. Exit For
  2405. Next
  2406.  
  2407. set GetServiceObject = objService
  2408. End Function
  2409.  
  2410. Function GetProductCollection(strSelect, strWhere)
  2411. Dim colProducts
  2412.  
  2413. On Error Resume Next
  2414.  
  2415. If strWhere = EmptyWhereClause Then
  2416. Set colProducts = g_objWMIService.ExecQuery("SELECT " & strSelect & " FROM " & ProductClass)
  2417. QuitIfError()
  2418. Else
  2419. Set colProducts = g_objWMIService.ExecQuery("SELECT " & strSelect & " FROM " & ProductClass & " WHERE " & strWhere)
  2420. QuitIfError()
  2421. End If
  2422.  
  2423. set GetProductCollection = colProducts
  2424. End Function
  2425.  
  2426. Function GetProductObject(strSelect, strWhere)
  2427. Dim objProduct
  2428. Dim colProducts
  2429.  
  2430. On Error Resume Next
  2431.  
  2432. Set colProducts = GetProductCollection(strSelect, strWhere)
  2433. QuitIfError()
  2434.  
  2435. For each objProduct in colProducts
  2436. QuitIfError()
  2437. Exit For
  2438. Next
  2439.  
  2440. set GetProductObject = objProduct
  2441. End Function
  2442.  
  2443. Private Function IsKmsClient(strDescription)
  2444. If InStr(strDescription, "VOLUME_KMSCLIENT") > 0 Then
  2445. IsKmsClient = True
  2446. Else
  2447. IsKmsClient = False
  2448. End If
  2449. End Function
  2450.  
  2451. Private Function IsTkaClient(strDescription)
  2452. IsTkaClient = IsKmsClient(strDescription)
  2453. End Function
  2454.  
  2455. Private Function IsKmsServer(strDescription)
  2456. If IsKmsClient(strDescription) Then
  2457. IsKmsServer = False
  2458. Else
  2459. If InStr(strDescription, "VOLUME_KMS") > 0 Then
  2460. IsKmsServer = True
  2461. Else
  2462. IsKmsServer = False
  2463. End If
  2464. End If
  2465. End Function
  2466.  
  2467. Private Function IsTBL(strDescription)
  2468. If InStr(strDescription, "TIMEBASED_") > 0 Then
  2469. IsTBL = True
  2470. Else
  2471. IsTBL = False
  2472. End If
  2473. End Function
  2474.  
  2475. 'Returns 0 if this is not the primary SKU, 1 if it is, and 2 if we aren't certain (older clients)
  2476. Function GetIsPrimaryWindowsSKU(objProduct)
  2477. Dim iPrimarySku
  2478. Dim bIsAddOn
  2479.  
  2480. 'Assume this is not the primary SKU
  2481. iPrimarySku = 0
  2482. 'Verify the license is for Windows, that it has a partial key, and that
  2483. If (LCase(objProduct.ApplicationId) = WindowsAppId And objProduct.PartialProductKey <> "") Then
  2484. 'If we can get verify the AddOn property then we can be certain
  2485. On Error Resume Next
  2486. bIsAddOn = objProduct.LicenseIsAddon
  2487. If Err.Number = 0 Then
  2488. If bIsAddOn = true Then
  2489. iPrimarySku = 0
  2490. Else
  2491. iPrimarySku = 1
  2492. End If
  2493. Else
  2494. 'If we can not get the AddOn property then we assume this is a previous version
  2495. 'and we return a value of Uncertain, unless we can prove otherwise
  2496. If (IsKmsClient(objProduct.Description) Or IsKmsServer(objProduct.Description)) Then
  2497. 'If the description is KMS related, we can be certain that this is a primary SKU
  2498. iPrimarySku = 1
  2499. Else
  2500. 'Indeterminate since the property was missing and we can't verify KMS
  2501. iPrimarySku = 2
  2502. End If
  2503. End If
  2504. End If
  2505. GetIsPrimaryWindowsSKU = iPrimarySku
  2506. End Function
  2507.  
  2508. Private Function WasPrimaryKeyFound(strPrimarySkuType)
  2509. If (IsKmsServer(strPrimarySkuType) Or IsKmsClient(strPrimarySkuType) Or (InStr(strPrimarySkuType, NotSpecialCasePrimaryKey) > 0) Or (InStr(strPrimarySkuType, TblPrimaryKey) > 0) Or (InStr(strPrimarySkuType, IndeterminatePrimaryKeyFound) > 0)) Then
  2510. WasPrimaryKeyFound = True
  2511. Else
  2512. WasPrimaryKeyFound = False
  2513. End If
  2514. End Function
  2515.  
  2516.  
  2517. Private Function CanPrimaryKeyTypeBeDetermined(strPrimarySkuType)
  2518. If ((InStr(strPrimarySkuType, IndeterminatePrimaryKeyFound) > 0) Or (InStr(strPrimarySkuType, NoPrimaryKeyFound) > 0)) Then
  2519. CanPrimaryKeyTypeBeDetermined = False
  2520. Else
  2521. CanPrimaryKeyTypeBeDetermined = True
  2522. End If
  2523. End Function
  2524.  
  2525.  
  2526. Private Function GetPrimarySKUType()
  2527. Dim objProduct
  2528. Dim strPrimarySKUType, strDescription
  2529. Dim iIsPrimaryWindowsSku
  2530.  
  2531. For Each objProduct in GetProductCollection(ProductIsPrimarySkuSelectClause, PartialProductKeyNonNullWhereClause)
  2532. strDescription = objProduct.Description
  2533. If (LCase(objProduct.ApplicationId) = WindowsAppId) Then
  2534. iIsPrimaryWindowsSku = GetIsPrimaryWindowsSKU(objProduct)
  2535. If (iIsPrimaryWindowsSku = 1) Then
  2536. If (IsKmsServer(strDescription) Or IsKmsClient(strDescription)) Then
  2537. strPrimarySKUType = strDescription
  2538. Exit For 'no need to continue
  2539. Else
  2540. If IsTBL(strDescription) Then
  2541. strPrimarySKUType = TblPrimaryKey
  2542. Exit For
  2543. Else
  2544. strPrimarySKUType = NotSpecialCasePrimaryKey
  2545. End If
  2546. End If
  2547. ElseIf ((iIsPrimaryWindowsSku = 2) And strPrimarySKUType = "") Then
  2548. strPrimarySKUType = IndeterminatePrimaryKeyFound
  2549. End If
  2550. Else
  2551. strPrimarySKUType = strDescription
  2552. Exit For 'no need to continue
  2553. End If
  2554. Next
  2555.  
  2556. If strPrimarySKUType = "" Then
  2557. strPrimarySKUType = NoPrimaryKeyFound
  2558. End If
  2559.  
  2560. GetPrimarySKUType = strPrimarySKUType
  2561. End Function
  2562.  
  2563. Private Function SetRegistryStr(hKey, strKeyPath, strValueName, strValue)
  2564. SetRegistryStr = g_objRegistry.SetStringValue(hKey, strKeyPath, strValueName, strValue)
  2565. End Function
  2566.  
  2567. Private Function DeleteRegistryValue(hKey, strKeyPath, strValueName)
  2568. DeleteRegistryValue = g_objRegistry.DeleteValue(hKey, strKeyPath, strValueName)
  2569. End Function
  2570.  
  2571. Private Function ExistsRegistryKey(hKey, strKeyPath)
  2572. Dim bGranted
  2573. Dim lRet
  2574.  
  2575. ' Check for KEY_QUERY_VALUE for this key
  2576. lRet = g_objRegistry.CheckAccess(hKey, strKeyPath, 1, bGranted)
  2577.  
  2578. ' Ignore real access rights, just look for existence of the key
  2579. If lRet<>2 Then
  2580. ExistsRegistryKey = True
  2581. Else
  2582. ExistsRegistryKey = False
  2583. End If
  2584. End Function
  2585.  
  2586. ' Resource manipulation
  2587.  
  2588. ' Get the resource string with the given name from the locale specific
  2589. ' dictionary. If not found, use the built-in default.
  2590. Private Function GetResource(name)
  2591. LoadResourceData
  2592. If g_resourceDictionary.Exists(LCase(name)) Then
  2593. GetResource = g_resourceDictionary.Item(LCase(name))
  2594. Else
  2595. GetResource = Eval(name)
  2596. End If
  2597. End Function
  2598.  
  2599. ' Loads resource strings from an ini file of the appropriate locale
  2600. Private Function LoadResourceData
  2601. If g_resourcesLoaded Then
  2602. Exit Function
  2603. End If
  2604.  
  2605. Dim ini, lang
  2606. Dim fso
  2607.  
  2608. Set fso = WScript.CreateObject("Scripting.FileSystemObject")
  2609.  
  2610. On Error Resume Next
  2611. lang = GetUILanguage()
  2612. If Err.Number <> 0 Then
  2613. 'API does not exist prior to Vista so no resources to load
  2614. g_resourcesLoaded = True
  2615. Exit Function
  2616. End If
  2617.  
  2618. ini = fso.GetParentFolderName(WScript.ScriptFullName) & "\slmgr\" _
  2619. & ToHex(lang) & "\" & fso.GetBaseName(WScript.ScriptName) & ".ini"
  2620.  
  2621. If fso.FileExists(ini) Then
  2622. Dim stream
  2623. Const ForReading = 1, TristateTrue = -1 'Read file in unicode format
  2624.  
  2625. Set stream = fso.OpenTextFile(ini, ForReading, False, TristateTrue)
  2626. ReadResources(stream)
  2627. stream.Close
  2628. End If
  2629.  
  2630. g_resourcesLoaded = True
  2631. End Function
  2632.  
  2633. ' Reads resource strings from an ini file
  2634. Private Function ReadResources(stream)
  2635. const ERROR_FILE_NOT_FOUND = 2
  2636. Dim ln, arr, key, value
  2637.  
  2638. If Not IsObject(stream) Then Err.Raise ERROR_FILE_NOT_FOUND
  2639.  
  2640. Do Until stream.AtEndOfStream
  2641. ln = stream.ReadLine
  2642.  
  2643. arr = Split(ln, "=", 2, 1)
  2644. If UBound(arr, 1) = 1 Then
  2645. ' Trim the key and the value first before trimming quotes
  2646. key = LCase(Trim(arr(0)))
  2647. value = TrimChar(Trim(arr(1)), """")
  2648.  
  2649. If key <> "" Then
  2650. g_resourceDictionary.Add key, value
  2651. End If
  2652. End If
  2653. Loop
  2654. End Function
  2655.  
  2656. ' Trim a character from the text string
  2657. Private Function TrimChar(s, c)
  2658. Const vbTextCompare = 1
  2659.  
  2660. ' Trim character from the start
  2661. If InStr(1, s, c, vbTextCompare) = 1 Then
  2662. s = Mid(s, 2)
  2663. End If
  2664.  
  2665. ' Trim character from the end
  2666. If InStr(Len(s), s, c, vbTextCompare) = Len(s) Then
  2667. s = Mid(s, 1, Len(s) - 1)
  2668. End If
  2669.  
  2670. TrimChar = s
  2671. End Function
  2672.  
  2673. ' Get a 4-digit hexadecimal number
  2674. Private Function ToHex(n)
  2675. Dim s : s = Hex(n)
  2676. ToHex = String(4 - Len(s), "0") & s
  2677. End Function
  2678.  
  2679.  
  2680. '' SIG '' Begin signature block
  2681. '' SIG '' MIIXVAYJKoZIhvcNAQcCoIIXRTCCF0ECAQExCzAJBgUr
  2682. '' SIG '' DgMCGgUAMGcGCisGAQQBgjcCAQSgWTBXMDIGCisGAQQB
  2683. '' SIG '' gjcCAR4wJAIBAQQQTvApFpkntU2P5azhDxfrqwIBAAIB
  2684. '' SIG '' AAIBAAIBAAIBADAhMAkGBSsOAwIaBQAEFOcStbUOBhqv
  2685. '' SIG '' mXtOSx9khj8SiWO3oIISMTCCBGAwggNMoAMCAQICCi6r
  2686. '' SIG '' EdxQ/1ydy8AwCQYFKw4DAh0FADBwMSswKQYDVQQLEyJD
  2687. '' SIG '' b3B5cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAu
  2688. '' SIG '' MR4wHAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
  2689. '' SIG '' ITAfBgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0
  2690. '' SIG '' eTAeFw0wNzA4MjIyMjMxMDJaFw0xMjA4MjUwNzAwMDBa
  2691. '' SIG '' MHkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n
  2692. '' SIG '' dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN
  2693. '' SIG '' aWNyb3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1p
  2694. '' SIG '' Y3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBMIIBIjANBgkq
  2695. '' SIG '' hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt3l91l2zRTmo
  2696. '' SIG '' NKwx2vklNUl3wPsfnsdFce/RRujUjMNrTFJi9JkCw03Y
  2697. '' SIG '' SWwvJD5lv84jtwtIt3913UW9qo8OUMUlK/Kg5w0jH9FB
  2698. '' SIG '' JPpimc8ZRaWTSh+ZzbMvIsNKLXxv2RUeO4w5EDndvSn0
  2699. '' SIG '' ZjstATL//idIprVsAYec+7qyY3+C+VyggYSFjrDyuJSj
  2700. '' SIG '' zzimUIUXJ4dO3TD2AD30xvk9gb6G7Ww5py409rQurwp9
  2701. '' SIG '' YpF4ZpyYcw2Gr/LE8yC5TxKNY8ss2TJFGe67SpY7UFMY
  2702. '' SIG '' zmZReaqth8hWPp+CUIhuBbE1wXskvVJmPZlOzCt+M26E
  2703. '' SIG '' RwbRntBKhgJuhgCkwIffUwIDAQABo4H6MIH3MBMGA1Ud
  2704. '' SIG '' JQQMMAoGCCsGAQUFBwMDMIGiBgNVHQEEgZowgZeAEFvQ
  2705. '' SIG '' cO9pcp4jUX4Usk2O/8uhcjBwMSswKQYDVQQLEyJDb3B5
  2706. '' SIG '' cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0IENvcnAuMR4w
  2707. '' SIG '' HAYDVQQLExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf
  2708. '' SIG '' BgNVBAMTGE1pY3Jvc29mdCBSb290IEF1dGhvcml0eYIP
  2709. '' SIG '' AMEAizw8iBHRPvZj7N9AMA8GA1UdEwEB/wQFMAMBAf8w
  2710. '' SIG '' HQYDVR0OBBYEFMwdznYAcFuv8drETppRRC6jRGPwMAsG
  2711. '' SIG '' A1UdDwQEAwIBhjAJBgUrDgMCHQUAA4IBAQB7q65+Siby
  2712. '' SIG '' zrxOdKJYJ3QqdbOG/atMlHgATenK6xjcacUOonzzAkPG
  2713. '' SIG '' yofM+FPMwp+9Vm/wY0SpRADulsia1Ry4C58ZDZTX2h6t
  2714. '' SIG '' KX3v7aZzrI/eOY49mGq8OG3SiK8j/d/p1mkJkYi9/uEA
  2715. '' SIG '' uzTz93z5EBIuBesplpNCayhxtziP4AcNyV1ozb2AQWtm
  2716. '' SIG '' qLu3u440yvIDEHx69dLgQt97/uHhrP7239UNs3DWkuNP
  2717. '' SIG '' tjiifC3UPds0C2I3Ap+BaiOJ9lxjj7BauznXYIxVhBoz
  2718. '' SIG '' 9TuYoIIMol+Lsyy3oaXLq9ogtr8wGYUgFA0qvFL0QeBe
  2719. '' SIG '' MOOSKGmHwXDi86erzoBCcnYOMIIEejCCA2KgAwIBAgIK
  2720. '' SIG '' YQHPPgAAAAAADzANBgkqhkiG9w0BAQUFADB5MQswCQYD
  2721. '' SIG '' VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G
  2722. '' SIG '' A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0
  2723. '' SIG '' IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQg
  2724. '' SIG '' Q29kZSBTaWduaW5nIFBDQTAeFw0wOTEyMDcyMjQwMjla
  2725. '' SIG '' Fw0xMTAzMDcyMjQwMjlaMIGDMQswCQYDVQQGEwJVUzET
  2726. '' SIG '' MBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVk
  2727. '' SIG '' bW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0
  2728. '' SIG '' aW9uMQ0wCwYDVQQLEwRNT1BSMR4wHAYDVQQDExVNaWNy
  2729. '' SIG '' b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEB
  2730. '' SIG '' AQUAA4IBDwAwggEKAoIBAQC9MIn7RXKoU2ueiU8AI8C+
  2731. '' SIG '' 1B09sVlAOPNzkYIm5pYSAFPZHIIOPM4du733Qo2X1Pw4
  2732. '' SIG '' GuS5+ePs02EDv6DT1nVNXEap7V7w0uJpWxpz6rMcjQTN
  2733. '' SIG '' KUSgZFkvHphdbserGDmCZcSnvKt1iBnqh5cUJrN/Jnak
  2734. '' SIG '' 1Dg5hOOzJtUY+Svp0skWWlQh8peNh4Yp/vRJLOaL+AQ/
  2735. '' SIG '' fc3NlpKGDXED4tD+DEI1/9e4P92ORQp99tdLrVvwdnId
  2736. '' SIG '' dyN9iTXEHF2yUANLR20Hp1WImAaApoGtVE7Ygdb6v0LA
  2737. '' SIG '' Mb5VDZnVU0kSMOvlpYh8XsR6WhSHCLQ3aaDrMiSMCOv5
  2738. '' SIG '' 1BS64PzN6qQVAgMBAAGjgfgwgfUwEwYDVR0lBAwwCgYI
  2739. '' SIG '' KwYBBQUHAwMwHQYDVR0OBBYEFDh4BXPIGzKbX5KGVa+J
  2740. '' SIG '' usaZsXSOMA4GA1UdDwEB/wQEAwIHgDAfBgNVHSMEGDAW
  2741. '' SIG '' gBTMHc52AHBbr/HaxE6aUUQuo0Rj8DBEBgNVHR8EPTA7
  2742. '' SIG '' MDmgN6A1hjNodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v
  2743. '' SIG '' cGtpL2NybC9wcm9kdWN0cy9DU1BDQS5jcmwwSAYIKwYB
  2744. '' SIG '' BQUHAQEEPDA6MDgGCCsGAQUFBzAChixodHRwOi8vd3d3
  2745. '' SIG '' Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL0NTUENBLmNy
  2746. '' SIG '' dDANBgkqhkiG9w0BAQUFAAOCAQEAKAODqxMN8f4Rb0J2
  2747. '' SIG '' 2EOruMZC+iRlNK51sHEwjpa2g/py5P7NN+c6cJhRIA66
  2748. '' SIG '' cbTJ9NXkiugocHPV7eHCe+7xVjRagILrENdyA+oSTuzd
  2749. '' SIG '' DYx7RE8MYXX9bpwH3c4rWhgNObBg/dr/BKoCo9j6jqO7
  2750. '' SIG '' vcFqVDsxX+QsbsvxTSoc8h52e4avxofWsSrtrMwOwOSf
  2751. '' SIG '' f+jP6IRyVIIYbirInpW0Gh7Bb5PbYqbBS2utye09kuOy
  2752. '' SIG '' L6t6dzlnagB7gp0DEN5jlUkmQt6VIsGHC9AUo1/cczJy
  2753. '' SIG '' Nh7/yCnFJFJPZkjJHR2pxSY5aVBOp+zCBmwuchvxIdpt
  2754. '' SIG '' JEiAgRVAfJ/MdDhKTzCCBJ0wggOFoAMCAQICEGoLmU/A
  2755. '' SIG '' ACWrEdtFH1h6Z6IwDQYJKoZIhvcNAQEFBQAwcDErMCkG
  2756. '' SIG '' A1UECxMiQ29weXJpZ2h0IChjKSAxOTk3IE1pY3Jvc29m
  2757. '' SIG '' dCBDb3JwLjEeMBwGA1UECxMVTWljcm9zb2Z0IENvcnBv
  2758. '' SIG '' cmF0aW9uMSEwHwYDVQQDExhNaWNyb3NvZnQgUm9vdCBB
  2759. '' SIG '' dXRob3JpdHkwHhcNMDYwOTE2MDEwNDQ3WhcNMTkwOTE1
  2760. '' SIG '' MDcwMDAwWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMK
  2761. '' SIG '' V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG
  2762. '' SIG '' A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYD
  2763. '' SIG '' VQQDExpNaWNyb3NvZnQgVGltZXN0YW1waW5nIFBDQTCC
  2764. '' SIG '' ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANw3
  2765. '' SIG '' bvuvyEJKcRjIzkg+U8D6qxS6LDK7Ek9SyIPtPjPZSTGS
  2766. '' SIG '' KLaRZOAfUIS6wkvRfwX473W+i8eo1a5pcGZ4J2botrfv
  2767. '' SIG '' hbnN7qr9EqQLWSIpL89A2VYEG3a1bWRtSlTb3fHev5+D
  2768. '' SIG '' x4Dff0wCN5T1wJ4IVh5oR83ZwHZcL322JQS0VltqHGP/
  2769. '' SIG '' gHw87tUEJU05d3QHXcJc2IY3LHXJDuoeOQl8dv6dbG56
  2770. '' SIG '' 4Ow+j5eecQ5fKk8YYmAyntKDTisiXGhFi94vhBBQsvm1
  2771. '' SIG '' Go1s7iWbE/jLENeFDvSCdnM2xpV6osxgBuwFsIYzt/iU
  2772. '' SIG '' W4RBhFiFlG6wHyxIzG+cQ+Bq6H8mjmsCAwEAAaOCASgw
  2773. '' SIG '' ggEkMBMGA1UdJQQMMAoGCCsGAQUFBwMIMIGiBgNVHQEE
  2774. '' SIG '' gZowgZeAEFvQcO9pcp4jUX4Usk2O/8uhcjBwMSswKQYD
  2775. '' SIG '' VQQLEyJDb3B5cmlnaHQgKGMpIDE5OTcgTWljcm9zb2Z0
  2776. '' SIG '' IENvcnAuMR4wHAYDVQQLExVNaWNyb3NvZnQgQ29ycG9y
  2777. '' SIG '' YXRpb24xITAfBgNVBAMTGE1pY3Jvc29mdCBSb290IEF1
  2778. '' SIG '' dGhvcml0eYIPAMEAizw8iBHRPvZj7N9AMBAGCSsGAQQB
  2779. '' SIG '' gjcVAQQDAgEAMB0GA1UdDgQWBBRv6E4/l7k0q0uGj7yc
  2780. '' SIG '' 6qw7QUPG0DAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMA
  2781. '' SIG '' QTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAN
  2782. '' SIG '' BgkqhkiG9w0BAQUFAAOCAQEAlE0RMcJ8ULsRjqFhBwEO
  2783. '' SIG '' jHBFje9zVL0/CQUt/7hRU4Uc7TmRt6NWC96Mtjsb0fus
  2784. '' SIG '' p8m3sVEhG28IaX5rA6IiRu1stG18IrhG04TzjQ++B4o2
  2785. '' SIG '' wet+6XBdRZ+S0szO3Y7A4b8qzXzsya4y1Ye5y2PENtEY
  2786. '' SIG '' Ib923juasxtzniGI2LS0ElSM9JzCZUqaKCacYIoPO8cT
  2787. '' SIG '' ZXhIu8+tgzpPsGJY3jDp6Tkd44ny2jmB+RMhjGSAYwYE
  2788. '' SIG '' lvKaAkMve0aIuv8C2WX5St7aA3STswVuDMyd3ChhfEjx
  2789. '' SIG '' F5wRITgCHIesBsWWMrjlQMZTPb2pid7oZjeN9CKWnMyw
  2790. '' SIG '' d1RROtZyRLIj9jCCBKowggOSoAMCAQICCmEGlC0AAAAA
  2791. '' SIG '' AAkwDQYJKoZIhvcNAQEFBQAweTELMAkGA1UEBhMCVVMx
  2792. '' SIG '' EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
  2793. '' SIG '' ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
  2794. '' SIG '' dGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFRpbWVzdGFt
  2795. '' SIG '' cGluZyBQQ0EwHhcNMDgwNzI1MTkwMjE3WhcNMTMwNzI1
  2796. '' SIG '' MTkxMjE3WjCBszELMAkGA1UEBhMCVVMxEzARBgNVBAgT
  2797. '' SIG '' Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc
  2798. '' SIG '' BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjENMAsG
  2799. '' SIG '' A1UECxMETU9QUjEnMCUGA1UECxMebkNpcGhlciBEU0Ug
  2800. '' SIG '' RVNOOjdBODItNjg4QS05RjkyMSUwIwYDVQQDExxNaWNy
  2801. '' SIG '' b3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIIBIjANBgkq
  2802. '' SIG '' hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlYEKIEIYUXrZ
  2803. '' SIG '' le2b/dyH0fsOjxPqqjcoEnb+TVCrdpcqk0fgqVZpAuWU
  2804. '' SIG '' fk2F239x73UA27tDbPtvrHHwK9F8ks6UF52hxbr5937d
  2805. '' SIG '' YeEtMB6cJi12P+ZGlo6u2Ik32Mzv889bw/xo4PJkj5vo
  2806. '' SIG '' wxL5o76E/NaLzgU9vQF2UCcD+IS3FoaNYL5dKSw8z6X9
  2807. '' SIG '' mFo1HU8WwDjYHmE/PTazVhQVd5U7EPoAsJPiXTerJ7tj
  2808. '' SIG '' LEgUgVXjbOqpK5WNiA5+owCldyQHmCpwA7gqJJCa3sWi
  2809. '' SIG '' Iku/TFkGd1RyQ7A+ZN2ThAhYtv7ph0kJNrOz+DOpfkyi
  2810. '' SIG '' eX8yWSkOnrX14DyeP+xGOwIDAQABo4H4MIH1MB0GA1Ud
  2811. '' SIG '' DgQWBBQolYi/Ajvr2pS6fUYP+sv0fp3/0TAfBgNVHSME
  2812. '' SIG '' GDAWgBRv6E4/l7k0q0uGj7yc6qw7QUPG0DBEBgNVHR8E
  2813. '' SIG '' PTA7MDmgN6A1hjNodHRwOi8vY3JsLm1pY3Jvc29mdC5j
  2814. '' SIG '' b20vcGtpL2NybC9wcm9kdWN0cy90c3BjYS5jcmwwSAYI
  2815. '' SIG '' KwYBBQUHAQEEPDA6MDgGCCsGAQUFBzAChixodHRwOi8v
  2816. '' SIG '' d3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL3RzcGNh
  2817. '' SIG '' LmNydDATBgNVHSUEDDAKBggrBgEFBQcDCDAOBgNVHQ8B
  2818. '' SIG '' Af8EBAMCBsAwDQYJKoZIhvcNAQEFBQADggEBAADurPzi
  2819. '' SIG '' 0ohmyinjWrnNAIJ+F1zFJFkSu6j3a9eH/o3LtXYfGyL2
  2820. '' SIG '' 9+HKtLlBARo3rUg3lnD6zDOnKIy4C7Z0Eyi3s3XhKgni
  2821. '' SIG '' i0/fmD+XtzQSgeoQ3R3cumTPTlA7TIr9Gd0lrtWWh+pL
  2822. '' SIG '' xOXw+UEXXQHrV4h9dnrlb/6HIKyTnIyav18aoBUwJOCi
  2823. '' SIG '' fmGRHSkpw0mQOkODie7e1YPdTyw1O+dBQQGqAAwL8tZJ
  2824. '' SIG '' G85CjXuw8y2NXSnhvo1/kRV2tGD7FCeqbxJjQihYOoo7
  2825. '' SIG '' i0Dkt8XMklccRlZrj8uSTVYFAMr4MEBFTt8ZiL31EPDd
  2826. '' SIG '' Gt8oHrRR8nfgJuO7CYES3B460EUxggSPMIIEiwIBATCB
  2827. '' SIG '' hzB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
  2828. '' SIG '' Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMV
  2829. '' SIG '' TWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQDExpN
  2830. '' SIG '' aWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQQIKYQHPPgAA
  2831. '' SIG '' AAAADzAJBgUrDgMCGgUAoIG6MBkGCSqGSIb3DQEJAzEM
  2832. '' SIG '' BgorBgEEAYI3AgEEMBwGCisGAQQBgjcCAQsxDjAMBgor
  2833. '' SIG '' BgEEAYI3AgEVMCMGCSqGSIb3DQEJBDEWBBQd14sj6H8n
  2834. '' SIG '' HEe9Uz/z9MkglmW3rjBaBgorBgEEAYI3AgEMMUwwSqAk
  2835. '' SIG '' gCIATQBpAGMAcgBvAHMAbwBmAHQAIABXAGkAbgBkAG8A
  2836. '' SIG '' dwBzoSKAIGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS93
  2837. '' SIG '' aW5kb3dzMA0GCSqGSIb3DQEBAQUABIIBAGV2G8+gtt0M
  2838. '' SIG '' UxM/KV3gjlyHNlUMeqtyovXI7xezHdoyqoNLc7c/y8Yd
  2839. '' SIG '' 5eNWVLTVtgyeCo3wQIetjEncCWhYwhIhZpyJDvbEKGtl
  2840. '' SIG '' RRdw0QeDGPfr4kO6QSOZSPDTf5t6ZPg7Cgno8TPbwJGk
  2841. '' SIG '' 0J8p1O7LxE6i0p62Fz6QKqitix6IGtCDq1DheEOW9aP0
  2842. '' SIG '' RYLbJ2XX3UJEC7nBhxHVC7IyrO6bF4VNgxXYCcfHsA1n
  2843. '' SIG '' LH5HGCDqRwMeX/JXSjVdrwIhsql25buPpT3OFz2sVwCd
  2844. '' SIG '' nD/MlrJ0ShiV7W4DhHRol9stg67xIXxlTEV3hIGsbOp2
  2845. '' SIG '' ipNjhIGIxnexEJBY/WcMQM6hggIfMIICGwYJKoZIhvcN
  2846. '' SIG '' AQkGMYICDDCCAggCAQEwgYcweTELMAkGA1UEBhMCVVMx
  2847. '' SIG '' EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
  2848. '' SIG '' ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
  2849. '' SIG '' dGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFRpbWVzdGFt
  2850. '' SIG '' cGluZyBQQ0ECCmEGlC0AAAAAAAkwBwYFKw4DAhqgXTAY
  2851. '' SIG '' BgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3
  2852. '' SIG '' DQEJBTEPFw0xMDA0MDIwMzE1MTVaMCMGCSqGSIb3DQEJ
  2853. '' SIG '' BDEWBBT15tgndbK2oHDTvYn4hP+1R6JFgzANBgkqhkiG
  2854. '' SIG '' 9w0BAQUFAASCAQBQH5OdzMQtKQEB66715jf6w0KiMrsL
  2855. '' SIG '' ffaVFaf1BP6pzQw2vU1zdu2cEt170xCaFKcRWZzzfYhN
  2856. '' SIG '' BqBJmDwd6lUKQVHkEgKb631pxNULxZEkXLBwAGw+BDGo
  2857. '' SIG '' fmVDm1jsSRyeStlV12dcL+7daRgbMlZTZebGxUBvullT
  2858. '' SIG '' xmAw4AQDhvRAx/AUf6TlI4VXT1KovQkQzVeiLWr/rV3i
  2859. '' SIG '' 7MZWklicVED6n1BUF1BIdV5JLiJjyLD5SU+bOY+XwmLD
  2860. '' SIG '' moSApfeBdOV46MRP9nL4R67eXIS1smBRBN97GhBSKtD5
  2861. '' SIG '' z2rKztpkSWtmYi3E6BY1lPeJShLl1j6rnxDkdjd4QVT7
  2862. '' SIG '' Kjj0
  2863. '' SIG '' End signature block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement