I have found a more simpler solution for the previous technique which can even be scripted to the point where it is all done for you (this guide doesn't automate every step, but you can easily do this for yourself once you get the general idea). All you will need is an installed copy of VMWare's free ESXi and away you go (assuming that you have the required compatible hardware for ESXi, a KMS licence server and a copy of Windows that you are using). Yes you can still do this with multiple VMs, but this is much more elegant and takes up a lot less space.
UPDATE - I have created a followup to this post. Please read, http://www.freneticrapport.com/2011/05/esxi-automation-kms-post-followup.html
Using your installed version of ESXi, create a new VM for the Windows version you want to install. This image does not need many resources, so make it as bare as possible (NIC, 1 CPU, 512MB RAM, DVD-ROM; installing Windows 7 on less than 512MB of RAM under ESXi gives a bluescreen).
Now do the following:
- Install Windowson the new guest you have created.
- Once installed and you are at the initial desktop shutdown the machine (when setting up, don't set a password to make things easier in the long run).
- Now disconnect the DVD-ROM device from the VM. This will make bootup faster for the snapshotted VMs (as the snapshot also stores the vmx file state).
- Now right click the guest and select Snapshot>Take Snapshot
- Start the machine back up again.
- Configure the machine to your liking (I suggest just keeping it close to stock, but maybe installing updates). Be sure to update the ntp settings at this point, as KMS has issues if times are out of sync.
- Copy these two scripts to the guest:
Generalise.bat
start cmd /c slmgr /rearm"timeout /t 10 /nobreak > NUL
wmic computersystem where name="%COMPUTERNAME%" call rename name="computer-%random%"
shutdown /r /t 0
Activate.bat
start cmd /c "slmgr.vbs /skms licence-kms:1688"
timeout /t 2 /nobreak > NUL
start cmd /c "slmgr.vbs /ipk FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4"
timeout /t 15 /nobreak > NUL
start cmd /c "slmgr.vbs /ato"
timeout /t 30 /nobreak > NUL
shutdown /s /t 0
Note: %random% just generates a random number, you can change this to whatever naming convention you like. The key above is the KMS licence key for Windows 7 Pro. Here are the other KMS licence keys appropriate for your system. You don't have to setup the first line of activate.bat if you have forward and reverse DNS settings for your KMS server setup correctly. - Set the generalise.bat script to start up at next boot (using run once perhaps), and also maybe add a line before shutdown in generalise.bat to add activate.bat to runonce. This is up to you, you can do this manaully if you want. The thing to note is that you want to run generalise first, and then run activate after the reboot.
If you have run out of rearms, change the following key in the registry to 1:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform]
"SkipRearm"=dword:00000001 - Now shutdown the machine.
- Create a new snapshot (I called this one configured).
- Now create multiple snapshots of this configured machine:
Firstly go into snapshot manager and click the "configured" snapshot and then click "go to". Now create a new snapshot (it will change the "you are here" target to the configured snapshot again;because it changes to the latest snapshot by default). Now this is the important bit, after each snapshot go into snapshot manager, click "configured" and then click "go to". Continue to do this until you have the desired number of dummy machines. You should get something like this:
- Now run each image by selecting the snapshot in the snapshop manager and clicking "go to", then starting the VM. Shutdown and snapshot between images. Once you shutdown each image you must snapshot, or your changes will be lost (you will be warned of this). You should get something that looks like this in the snapshot manager:
Now watch your count go up on the KMS host (slmgr /dlv) :)
The proceedure above allows you to reset CMID without running sysprep generalize. This isn't supported by Microsoft and should only be used on the dummy machines. Your actual SOE should run sysprep before rolling out images.
Note, do not add key until you have snapshoted the config, otherwise you will have the same activation ID as all the machine and your KMS count will not go up.
All you need to do now is start the machines from each snapshot up once every 180 days. You can automate this with vSphere CLI.
No comments:
Post a Comment