How to use the Windows Server License Manager Script - slmgr.vbs
Like it or not, Windows Server licensing is more critical than ever before with Windows Server 2008. It is important to know how to license your Windows 2008 Servers from the command line, to see how much time you have left in an eval, or uninstall licenses. In this article, you will learn how to use Microsoft’s command line tool for doing that – slmgr.vbs.
What is slmgr.vbs?
Microsoft’s command line licensing tool is slmgr.vbs. The name actually stands for Windows Software Licensing Management Tool.
This is a visual basic script used to configure licensing on any Windows 2008 Server – either the full version or the core version. To see what slmgr.vbs can do, you can simply run a Windows command prompt (with cmd) and type:
Figure 1: Help window for slmgr.vbs
This will pop up a help window that will give you all the slmgr.vbs options. Here are the various tasks you can perform with slmgr.vbs:
- Manage licensing not only on the local server but also on remote Windows 2008 Servers, over the network. A username and password is required for this. The default machine to manage, if none is specified, is the localhost.
- Install product keys with the –ipk option.
- Active Windows 2008 with the –ato option.
- Display license information with the –dli option.
- Display detailed license information with the –dlv option.
- Show when the current Windows license will expire with the –xpr option.
- Clear the current Windows product key from the registry for security reasons with the –cpky option.
- Install a license with the –ilc option.
- Reinstall system license files with the –rilc option.
- Reactive a Windows evaluation license with the –rearm option.
- Uninstall a certain product key with the –upk option.
- Display your installation ID, used by Microsoft for offline (telephone) activation, with the –dit option.
- And finally, you can active a product with the confirmation ID using the –ato option.
Let’s see some examples of how Windows 2008 slmgr.vbs can help us.
How can slmgr.vbs help with Evaluation licensing?
If you are evaluating Windows Server 2008, you should know that license activation is not required. An evaluation version of Windows Server 2008 will work for 60 days. While many admins do not know it, you can “re-arm” that evaluation period for another 60 days, three times over. Thus, you could evaluate Windows 2008 Server for a total of 240 days, or about 8 months – wow!
You can re-arm this evaluation of Windows 2008 using slmgr.vbs. To do this, just type:
Figure 2: Results after rearming your Win 2008 evaluation copy for another 60 days
To see how much time you have left in your current evaluation period, just type:
Figure 3: Results of xpr command, showing the date and time that the license grace period for Win 2008 expires
In fact, Microsoft even has an interesting knowledgebase document on how to automatically extend the evaluation of licensing with a script. By implementing this script, you could use Windows Server 2008 for the full 240 days without having to do anything. For more information on that, please see Microsoft KB 948472.
How do I get detailed information on my Windows Server 2008 license?
To get more detailed information than just the expiration date (given by the xpr command), you can use the dli or dlv options. Here is what their output looks like:
Figure 4: slmgr.vbs –dli output showing license information
As you can see in the –dli option output, there is more information on the version of Win 2008 you are running, the license status, time renaming (down to the second), and all about the key management server.
Figure 5: slmgr.vbs –dlv output showing detailed license information
With the –dlv option, there is even more detailed information about the current state of your licenses.
How can I activate my license in Windows 2008 Server Core?
As I mentioned above, when I listed out the options, slmgr.vbs is used to activate Windows 2008 Server at the command line. Now in Windows Server Core, with only a command prompt, you are forced to use slmgr.vbs to activate your Core server from the command line. Thus, it is much more critical to know how to use slmgr.vbs if you are using Windows Server Core. Still, every Admin, in my opinion, should know the basics of using it.
So, say that you are on your new Windows Server 2008 Core server and you want to activate it. Let’s assume that you entered a product key during the installation process. To activate your OS, just type:
If you do not have networking configured, or you get another error, you will get a window that says something like this:
Figure 6: Error from slmgr license activation
In my case, I received this error because I had not yet configured an IP address on the Win 2008 Core Server. And, I received the error again because I did not have DNS and a default gateway configured. Keep in mind that all of these things are necessary for a successful activation of Windows 2008!
If you did not enter a product key during the install process, you can enter one with slmgr.vbs at the command line with:
slmgr.vbs –ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
(assuming you have a MAK key, not a KMS key)
From there, you can attempt the auto activation again.
Figure 7: Successful activation of Windows 2008 with slmgr.vbs
If you are successful (as I finally was), you should see the “product activated successfully” window, as you see in Figure 7. Hoorah!
How do I administer licensing of a remote Windows 2008 Server using slmgr.vbs?
As I mentioned above, you can administer not only local servers but also remote Win 2008 Servers from the command line, using slmgr.vbs. You just need the server hostname/IP address as well as the administrator username and password.
To do this, just place the machinename, then username, and then the password between the slmgr command and the options, like this:
slmgr.vbs server2 administrator MyPassWord1 -xpr
You do not have to use the .vbs extension on the slmgr command. It will work just fine if you type slmgr and your command options.
Windows Server licensing is critical to your Windows 2008 Server functioning, or not functioning. In this article, you saw how to use Microsoft’s Software Licensing Management Tool – slmgr.vbs – to manage your Windows Server licenses from the command line. While there are a number of applications for slmgr.vbs, after reading this article I know that the next time you are at a command prompt of a Win 2008 Core Server with an expired license, you will know exactly what to do.