Using SysPrep on Windows 2012R2
Build
First install Windows 2012R2 Server.
Patch
Install all Windows Patches. At least the Critical and Security updates.
Create Snapshot
Take the first Snapshot before running SysPrep.
SysPrep
Run SysPrep with the shutdown command.
Create New VM
Clone the VM machine to a new machine.
Customise VM
Now just changed the server name and add to the domain.
Maintain Template
Ensure that you regularly update the VM with the latest patches.
I’m using SysPrep on Windows 2012R2 and Acropolis (AHV) and Prism by Nutanix to show how simple it is to create many new Windows 2012R2 Virtual Machine (VM) servers, when you are not using VMware or something else that does a lot of the hard work for you.
VMware provides enhanced capabilities when using a pre-created VM template. As those who know, it is then a simple matter of deploying a new VM from a template, giving it a name, which it normally gets from the name that you have provided and then you choose a few options and the new VM is built and potentially joined to the domain.
With Prism, I’m sure there are some fairly clever ways of doing this, but I’m no coder or script whiz, so I’m going to do it all via their rather nice GUI and a few manual steps.
Using SysPrep on Windows 2012R2 will not suit those who need to deploy hundreds of machines in continous cycles for heavy dev and test platforms.
Using SysPrep on Windows 2012R2 will provide those smaller business a way to deploy VM with less hassle than building a server from scratch using an ISO each time they need a new Server VM.
Build
Step 1 is to build your first Windows 2012R2 server. Most likely from an ISO.
patch
Once you have built your first Windows 2012R2 Server and patched it, you don’t need to join it to the domain, you are nearly ready to use SysPrep on Windows 2012R2.
Create Snapshot
Before using SysPrep on Windows 2012R2 command on this brand new server VM, you will want to make a Snapshot first.
I find this particularly useful, as I can then revert the VM to an earlier Snapshot that was not Sysprep’d and quickly patch to the latest updates.
To make this procedure repeatable, I Snapshot it once again, before starting the SysPrep command.
With the Nutanix platform and with de-duplication enabled, these Snapshots and Clones takes up very little space on the actual disk.
Create a Snapshot
Within Nutanix Prism Web Interface, find the VM that you are going to use as your template.
Select the VM and then Click on Take Snapshot.
Enter some text for the name of the Snapshot.
Make it descriptive so you can find it easily later on. If you are going to keep many Snapshots.
Under VM Snapshots you can now see a list of snapshots.
SysPrep
Now we are going to run Sysprep on Windows 2012R2, this is very simple, just open a command prompt with Administrator rights and then ensure that you are in the correct folder
C:\Windows\system32\Sysprep
Then run
sysprep /generalize /oobe /shutdown
You will now see this little dialog appear on your Windows Server VM.
The Server will then shutdown once the operation has completed.
You Template VM, is now complete.
At this point I normally create another Snapshot, something that I can roll back to if need be.
I personally normally tidy up, keeping the Snapshot that I did after patching the VM, but before performing the SysPrep on Windows 2012R2.
I also retain the Snapshot after SysPrep had completed and shutdown the server VM.
Create New VMs
Under the current Nutanix Community Edition that I am using, I have found that you cannot clone multiple new VMs from a VM Snapshot.
If you only wanted 1 new Virtual Machine, you could clone directly from the Snapshot, or if you plan to create multiple VMs at a time, you clone from the VM that we have SysPrep’d.
Clone from the Snapshot that you performed, after you ran Sysprep and the VM had shutdown.
Click on the your Virtual Machine, so that it is highlighted.
With the VM highlighted, Click on Clone.
Under General Configuration, Complete the information that you require to create a clone or multiple clone VMs.
If creating multiple, you can also define how many (1), a prefix (2), the starting number (3). You are also shown an example of what the VM display names will look like (4) within the GUI.
When you are happy with vCPUs, cores in vCPU and Memory, Disks assigned, Click on Save, this will submit the request.
Pretty quickly the new VMs will be shown in the GUI.
Now you can power the VMs on.
As we are not using any fancy scripts, answer files and as I personally don’t require hundreds of VMs, maybe the occasional new Server VM, All I do now, is complete the standard 2012R2 installation.
Pretty quickly the new VMs will be shown in the GUI.
Choose your Region.
Enter a Product Key
Agree to the Microsoft Terms.
Set the Administrators Password.
Change Server Name and Domain Membership
The final steps, that only take a few minutes in my experience, is to rename the Server and then add it to a domain.
You can then install any applications or features/roles that that server will provide.
Maintain Your Template VM.
Now that you are creating new VMs from your Template, you will need to ensure that you periodically perform maintenance, like updating the latest Windows security and critical patches.
This is a simple case of reverting to the Snapshot you created before running the SysPrep command.
Power the VM on, then perform your maintenance.
Once complete, create a new Snapshot before performing Sysprep command.
Summary
When using Sysprep on Windows 2012R2, with Nutanix CE, AHV and Prism, this is all pretty quick and simple. For the smaller environments who may be looking at virtualisation and don’t want to pay for virtualisation and the annual fees that come with it, or don’t want to consume lots of disk space hosting Hyper-V. Nutanix, AHV and Prism provide a very cohesive platform to use.
AHV on a Nutanix platform can reduce your costs and if you are not a Service Provider, but a small to medium business, that does not need all the functionally that the other hypervisor vendors bring, but just require the basics, like High availability, the the combination of Using SysPrep on Windows 2012R2 and Acropolis by Nutanix will be some real would cost saving, as you now longer need to pay annual renewal fees.