Pages

Monday 4 February 2013

KMS with VDI

Please check out www.kaztechsolutions.co.uk for more of my technical posts, alternately please call us on 01932 268289. 

Anyone doing VDI at somepoint will have to deal with MS licensing and the joys of KMS!  Now if you haven't done it before and you start to read about it on the Technet and what not apparently its really easy to setup and all you need is 25 unique connections to the KMS host to start activating Windows 7 and 5 unique connections for office 2010.  RUBBISH - there's loads of little "gotcha's" that both MS and Citrix don't make you aware of.  

Hopefully this will help a few people out with the pain that is KMS...!

Setting up the KMS Host

NOTE: Always run a CMD in elevated mode.

  • Designate a KMS host – has to be 2008 R2 or Windows 7. (You can use 2003... If you have too.)
  • Get KMS host key from your MS volume licensing site. DO NOT USE THE KMS CLIENT KEY!
  • Run a cscript slmgr.vbs /dlv and you'll see that the KMS Host is currently using a KMS Client key.
  • Run cscript slmgr.vbs /ipk XXXXX-KMS-host-key-XXXXX.  This changes the licensing mode to be a KMS Host instead of a KMS Client.
  • cscript slmgr.vbs /ato to activate your KMS Host against your MS volume licensing.
  • After activating the KMS key, restart the Software Protection Service.
  • Re-run a cscript slmgr.vbs /dlv to see the current KMS count is 0 and you'll also notice that the licensing has changes to a KMS Host.
Setting up a KMS Client


  • On the golden image if you have changed the license key to a MAK change back to a KMS client key.  Windows automatically comes using a KMS client Key but if you need to change it back use the key from the KMS Client Key website.  DO NOT ENTER THE KMS HOST KEY IN TO A CLIENT!
  • On the golden image type the following command to verify the DNS SRV Record: nslookup –type= srv_vlmcs._tcp
  • Check that you can ping the KMS host.
  • Attempt Windows 7 KMS Client activation using the following command: slmgr.vbs /ato
  • The activation attempt will fail with an error that the activation count is insufficient, this is fine but check on the KMS Host that it has received the request by running a cscript slmgr.vbs /dlv on the designated KMKS Host and the count should be 1.
  • Since KMS requires 25 unique activation requests to activate the clients spin up 25 desktops.
  • VDI-in-a-Box ensure that the activation timer is enabled within the template and for XenDesktop PVS install ensure that the vDisk is set to KMS.

  • Now a KMS client will automatically try to register against the KMS host using the DNS SRV record but you can speed this process up by using the VAMT 2.0 to force the activation.   Select 25 or more VM’s and choose to active via KMS.


  • Run a cscript slmgr.vbs /dlv to see the current KMS count should be above 25, all other windows 7 VM’s will now rergister.

Setting up Office 2010

  • For office make sure that the KMS host has the Microsoft Office 2010 KMS Host License Pack installed along with the KMS Host Office 2010 key from the your MS volume licensing site.
  • On the golden image make sure that the Office 2010 installation have the KMS client key and like Windows 7 Office 2010 comes with a KMS Client key.
  • From a CMD run a cscript ospp.vbs /dcmid from C:\Program Files (x86)\Microsoft Office\Office14 to see the CMID.
  • Start a new CMD and run the following command to allow access to run the Office rearm correctly - icacls C:\ProgramData\Microsoft\OfficeSoftwareProtectionPlatform /grant "Network Service:(OI)(CI)(R,W,D)" /t.
  • Start a CMD and run a OSPPREARM.EXE from C:\Program Files (x86)\Common Files\microsoft shared\OfficeSoftwareProtectionPlatform and this will clear the CMID.
  • Rerun a cscript ospp.vbs /dcmid and you'll see the CMID is now cleared.
  • Save and/or publish image so that it is now live, if you are using VDI-in-a-Box make sure you tick the "reset activation timer" in the template.
  • Activate Office 2010 on 5 desktops by running a CMD from  %programfiles(x86)%\microsoft office\office14\cscript ospp.vbs /act (note: activation will fail for the first 5 desktops and you can also use VAMT 2.0 to do this.)
  • Veryify that unique CMIDs are created for each desktop by running %programfiles(x86)%\microsoft office\office14\cscript ospp.vbs /dcmid
  • On desktop number 6, KMS activation should work without errors.
I hope this help a few people out and if i get some time I'll put some screenshots of the commands being run just to give a little bit more help.

Troubleshooting Tips
if you have to re-enter a office KMS key as you are currently using a MAK use the following command from %programfiles%\Microsoft Office\Office14.

 cscript ospp.vbs /inpkey:

Thanks

2 comments:

  1. Fan freaking tastic. Exactly what I needed. Way clearer than anything MSFT has published. Thanks mate!

    ReplyDelete
  2. First of all: Great Post!
    One question, I'm deploying images using SCCM2012, also for VDI-in-a-box (to 1 VM, where we make an ViaB-image from). During the TaskSequence I install Office and in ViaB I have that checkbox checked.
    Can I add the script for office in the end of the TaskSequence? Or should we run the OSPPREARM.EXE & ospp.vbs /dcmid after the Golden Image is created?

    ReplyDelete