Microsoft’s Key Management Server, better known as KMS, is around for many years and helps Administrators around the world activating Microsoft Products in their Enterprises. This includes Products like Windows or Office, for example.
Usually, a Client uses a DNS Service Locator to find its KMS Server for sending the Activation Request. This works great if your KMS Server is already in Production. However, if you are currently preparing a new KMS Server, you might want to channel your new clients to this dedicated KMS Server only.
Setting a static KMS Server manually
For configuring Volume Activation Tasks on a Windows Operating System, you have to use the Script “slmgr.vbs”, which can be found in “C:\Windows\system32”.
Running this Script with the Parameter “-skms” allows you, to set a static KMS Server and overwrite the value, that was retrieved using DNS. The following is an example, which sets the KMS Server to “KMS02.msitproblog.com”
"%WINDIR%\system32\slmgr.vbs" -skms KMS02.msitproblog.com
When done, you actually need to perform the Activation Request, using the following command:
"%WINDIR%\system32\slmgr.vbs" -ato
Modifying the ConfigMgr Task Sequence
Knowing the above commands, you can now start to integrate them into your OSD Task Sequence. I’ll do that on an example Task Sequence, which is deploying Windows 10 Enterprise.
Start by creating a new group “KMS Settings” somewhere after the Step “Setup Windows and Configuration Manager”.
In this group, create a new “Run Command Line” Step, called “Set Static KMS Server”. Specify the following Command line
cscript //B "%windir%\system32\slmgr.vbs" -skms KMS02.msitproblog.com
Note: We’re calling the script here via cscript and the “//B” Parameter, which tells Windows Script Host to run the script in “Batch Mode” (-> Non Interactive)
Make sure to enable the Checkbox “Disable 64-bit file system redirection”. I had some weird issues, when the checkbox was un-ticked.
Create again a new “Run Command Line” Step, called “Perform Activation Request”. Specify the following Command Line
cscript //B "%windir%\system32\slmgr.vbs" -ato
Make sure to again tick the Checkbox “Disable 64-bit file system redirection.
That’s it. When you run the Task Sequence the next time, the specified KMS Settings will get applied.
Removing the static KMS Server
With the following command, you can configure your Client to remove the previously added “static” KMS Server and revert back, using the information from DNS.
"%WINDIR%\system32\slmgr.vbs" -ckms
Followed above steps. Set KMS Server sucessfully ran but getting below error at “Perform Activation Request” step..
In SCCM Console –> In Monitoring -> Task Sequence Deployment status -> Showing following error :
*************************************
smswd.exe
PackageID=”
BaseVar = “, ContinueOnError=”
ProgramName = `cscript //B “C:\Windows\sytem32\slmgr.vbs” -ato`
SwdAction = `0001`
Set command line:Run Command line
Working dir `not set`
Executing command line:Run command line
Process completed with exit code 3221549172
Command line cscript //B “C:\Windows\sytem32\slmgr.vbs” -ato returned 3221549172
What happens when you manually execute the two KMS Commands after OSD completed? Any special output (error) in cmd?