'
' Copyright (c) Microsoft Corporation. All rights rerved.
'
' Windows Software Licensing Management Tool.
'
' Script Name: slmgr.vbs
'
Dim g_objWMIService, g_strComputer, g_strUrName, g_strPassword
g_strComputer = "."
dim g_EchoString
g_EchoString = ""
大业元年dim g_objRegistry
Dim g_resourceDictionary, g_resourcesLoaded
Set g_resourceDictionary = CreateObject("Scripting.Dictionary")
g_resourcesLoaded = Fal
' Messages
'Global options
private const L_optInstallProductKey = "ipk"
private const L_optInstallProductKeyUsage = "Install product key (replaces existing key)"
private const L_optUninstallProductKey = "upk"
private const L_optUninstallProductKeyUsage = "Uninstall product key"
private const L_optActivateProduct = "ato"
private const L_optActivateProductUsage = "Activate Windows"
private const L_optDisplayInformation = "dli"
private const L_optDisplayInformationUsage = "Display licen information (default: current licen)"
private const L_optDisplayInformationVerbo = "dlv"
private const L_optDisplayInformationUsageVerbo = "Display detailed licen information (default: current licen)"
private const L_optExpirationDatime = "xpr"
private const L_optExpirationDatimeUsage = "Expiration date for current licen state"
'Advanced options
private const L_optClearPKeyFromRegistry = "cpky"
private const L_optClearPKeyFromRegistryUsage = "Clear product key from the registry (preve
宠爱歌曲nts disclosure attacks)"
private const L_optInstallLicen = "ilc"
private const L_optInstallLicenUsage = "Install licen"阳宝华
private const L_optReinstallLicens = "rilc"
private const L_optReinstallLicensUsage = "Re-install system licen files"
private const L_optDisplayIID = "dti"
private const L_optDisplayIIDUsage = "Display Installation ID for offline activation"
private const L_optPhoneActivateProduct = "atp"
private const L_optPhoneActivateProductUsage = "Activate product with ur-provided Confirmation ID"
private const L_optReArmWindows = "rearm"
private const L_optReArmWindowsUsage = "Ret the licensing status of the machine"
organize
'KMS options
private const L_optSetKmsName = "skms"
private const L_optSetKmsNameUsage = "Set the name and/or the port for the KMS computer this machine will u"
private const L_optClearKmsName = "ckms"
private const L_optClearKmsNameUsage = "Clear name of KMS computer ud (ts the port to the default)"
private const L_optSetActivationInterval = "sai"
private const L_optSetActivationIntervalUsage = "Se
t 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."
private const L_optSetRenewalInterval = "sri"
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."
private const L_optSetKmsListenPort = "sprt"
private const L_optSetKmsListenPortUsage = "Set TCP port KMS will u to communicate with clients"
private const L_optSetDNS = "sdns"
private const L_optSetDNSUsage = "Enable DNS publishing by KMS (default)"
private const L_optClearDNS = "cdns"
private const L_optClearDNSUsage = "Disable DNS publishing by KMS"
private const L_optSetNormalPriority = "spri"
private const L_optSetNormalPriorityUsage = "Set KMS priority to normal (default)"
private const L_optClearNormalPriority = "cpri"
private const L_optClearNormalPriorityUsage = "Set KMS priority to low"
' Token-bad Activation options
困扰的近义词
private const L_optListInstalledILs = "lil"
private const L_optListInstalledILsUsage = "List installed Token-bad Activation Issuance Licens"
private const L_optRemoveInstalledIL = "ril"
private const L_optRemoveInstalledILUsage = "Remove installed Token-bad Activation Issuance Licen"
private const L_optClearTkaOnly = "ctao"
private const L_optClearTkaOnlyUsage = "Clear Token-bad Activation Only flag (default)"
private const L_optSetTkaOnly = "stao"
private const L_optSetTkaOnlyUsage = "Set Token-bad Activation Only flag"
private const L_optListTkaCerts = "ltc"
private const L_optListTkaCertsUsage = "List Token-bad Activation Certificates"
private const L_optForceTkaActivation = "fta"
private const L_optForceTkaActivationUsage = "Force Token-bad Activation"
' Option parameters
private const L_ParamsActivationID = "<Activation ID>"转让群
private const L_ParamsActivationIDOptional = "[Activation ID]"
private const L_ParamsActIDOptional = "[Activation ID | All]"
private const L_ParamsProductKey = "<Product Key>"
private const L_ParamsLicenFile = "<Licen file>"
private const L_ParamsPhoneActivate = "<Confirmation ID>"
private const L_ParamsSetKms = "<Name[:Port] | :Port>"
private const L_ParamsSetListenKmsPort = "<Port>
"
private const L_ParamsSetActivationInterval = "<Activation Interval>"
private const L_ParamsSetRenewalInterval = "<Renewal Interval>"
private const L_ParamsRemoveInstalledIL = "<ILID> <ILvID>"
private const L_ParamsForceTkaActivation = "<Certificate Thumbprint> [<PIN>]"
' Miscellaneous messages
private const L_MsgHelp_1 = "Windows Software Licensing Management Tool"
private const L_MsgHelp_2 = "Usage: slmgr.vbs [MachineName [Ur Password]] [<Option>]"
private const L_MsgHelp_3 = "MachineName: Name of remote machine (default is local machine)"
private const L_MsgHelp_4 = "Ur: Account with required privilege on remote machine"
private const L_MsgHelp_5 = "Password: password for the previous account"
private const L_MsgGlobalOptions = "Global Options:"
private const L_MsgAdvancedOptions = "Advanced Options:"
带有数字的成语private const L_MsgKmsClientOptions = "Volume Licensing: Key Management Service (KMS) Client Options:"
private const L_MsgKmsOptions = "Volume Licensing: Key Management Service (KMS) Options:"
private const L_MsgTkaClientOptions = "Volume Licensing: Token-bad Activation Options:"
private const L_MsgMissingOption = "Option is missing and it must be provided"
private const L_MsgUnrecognizedOption = "Unrecognized option: "
private const L_MsgErrorProductNotFound = "Error: product not found."
private const L_MsgClearedPKey = "Product key from registry cleared successfully."
private const L_MsgInstalledPKey = "Installed product key %PKEY% successfully."
private const L_MsgUninstalledPKey = "Uninstalled product key successfully."
private const L_MsgErrorPKey = "Error: product key not found."
private const L_MsgInstallationID = "Installation ID: "
private const L_MsgPhoneNumbers = "Product activation telephone numbers can be obtained by arching 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\slui\phone.inf"
private const L_MsgActivating = "Activating %PRODUCTNAME% (%PRODUCTID%) ..."
private const L_MsgActivated = "Product activated successfully."
private const L_MsgActivated_Failed = "Error: Product activation failed."
private const L_MsgConfID = "Confirmation ID for product %ACTID% deposited successfully."
private const L_MsgErrorDescription = "Error description: "
private const L_Msg
ErrorConnection = "Error 0x%ERRCODE% occurred in connecting to rver %COMPUTERNAME%."
private const L_MsgInfoRemoteConnection = "Connected to rver %COMPUTERNAME%."
private const L_MsgErrorConnectionRegistry = "Error 0x%ERRCODE% occurred in connecting to the registry on rver %COMPUTERNAME%."
private const L_MsgErrorConnectionProcessor = "Error 0x%ERRCODE% occurred in connecting to the processor on rver %COMPUTERNAME%."
private const L_MsgErrorImpersonation = "Error 0x%ERRCODE% occurred in tting impersonation level."
private const L_MsgErrorWMI = "Error 0x%ERRCODE% occurred in creating a locator object."
private const L_MsgErrorText_6 = "Run ' 0x2a 0x%ERRCODE%' to display the error text."
private const L_MsgErrorText_8 = "Error: "
private const L_MsgErrorText_9 = "Error: option %OPTION% needs %PARAM%"
private const L_MsgErrorText_11 = "The machine is running within the non-genuine grace period. Plea run ' 0x31' to go online and make the machine genuine."
private const L_MsgErrorText_12 = "Windows is running within the non-genuine notification period. Plea run ' 0x31' to go online and validate Windows."
private const L_MsgLicenFile = "Licen file %LICENSEFILE% installed successfully."
private const L_MsgKmsPriSetToLow = "KMS priority t to Low"
private const L_MsgKmsPriSetToNormal = "KMS priority t to Normal"
private const L_MsgWarningKmsPri = "Warning: Priority can only be t on a KMS machine that is also activated."
private const L_MsgKmsDnsPublishingDisabled = "DNS publishing disabled"
private const L_MsgKmsDnsPublishingEnabled = "DNS publishing enabled"
private const L_MsgKmsDnsPublishingWarning = "Warning: DNS Publishing can only be t on a KMS machine that is also activated."
private const L_MsgKmsPortSet = "KMS port t to %PORT% successfully."
private const L_MsgWarningKmsReboot = "Warning: a KMS reboot is needed for this tting to take effect."
private const L_MsgWarningKmsPort = "Warning: KMS port can only be t on a KMS machine that is also activated."
private const L_MsgRenewalSet = "Volume renewal interval t to %RENEWAL% minutes successfully."
private const L_MsgWarningRenewal = "Warning: Volume renewal interval can only be t on a KMS machine that is also activated."
private const L_MsgActivationSet = "Volume activation interval t to %ACTIVATION% minutes successfully."
private const L_MsgWarningActivation = "Warning: Volume activation interval can only be t on a KMS machine that is also activated."
pr
ivate const L_MsgKmsNameSet = "Key Management Service machine name t to %KMS% successfully."
private const L_MsgKmsNameCleared = "Key Management Service machine name cleared successfully."
private const L_MsgRearm_1 = "Command completed successfully."
private const L_MsgRearm_2 = "Plea restart the system for the changes to take effect."
private const L_MsgLicenStatusUnlicend = "Windows is unlicend"
private const L_MsgLicenStatusVL = "Volume activation will expire %ENDDATE%"
private const L_MsgLicenStatusLicend = "The machine is permanently activated."
private const L_MsgLicenStatusInitialGrace = "Initial grace period ends %ENDDATE%"
private const L_MsgLicenStatusAdditionalGrace = "Additional grace period ends %ENDDATE%"
private const L_MsgLicenStatusNonGenuineGrace = "Non-genuine grace period ends %ENDDATE%"
private const L_MsgLicenStatusNotification = "Windows is in Notification mode"
private const L_MsgLicenStatusUnlicend_1 = "Licen Status: Unlicend"
private const L_MsgLicenStatusLicend_1 = "Licen Status: Licend"
private const L_MsgLicenStatusVL_1 = "Volume activation expiration: %MINUTE% minute(s) (%DAY% day(s))"
private const L_MsgLicenStatusInitialGrace_1 = "Licen Status: Initial grace period"
private const L_MsgLicenStatusAdditionalGrace_1 = "Licen Status: Additional grace period (KMS licen expired or hardware out of tolerance)"
private const L_MsgLicenStatusNonGenuineGrace_1 = "Licen Status: Non-genuine grace period."
private const L_MsgLicenStatusNotification_1 = "Licen Status: Notification"
private const L_MsgNotificationErrorReasonNonGenuine = "Notification Reason: 0x%ERRCODE% (non-genuine)."
private const L_MsgNotificationErrorReasonExpiration = "Notification Reason: 0x%ERRCODE% (grace time expired)."
private const L_MsgNotificationErrorReasonOther = "Notification Reason: 0x%ERRCODE%."
private const L_MsgLicenStatusTimeRemaining = "Time remaining: %MINUTE% minute(s) (%DAY% day(s))"
private const L_MsgLicenStatusUnknown = "Licen Status: Unknown"
private const L_MsgLicenStatusEvalEndData = "Evaluation End Date: "
private const L_MsgReinstallingLicens = "Re-installing licen files ..."
private const L_MsgLicensReinstalled = "Licen files re-installed successfully."
private const L_MsgServiceVersion = "Software licensing rvice version: "
private const L_MsgProductName = "Name: "
private const L_MsgProductDesc = "Description: "
private const L_MsgActID = "Activation ID: "
蚀刻片private const L_MsgAppID = "Application ID: "
pri