One of the advantages to running Windows Server 2012 is the highly improved Hyper-V engine. In my time working on deployment scenarios I have found that creating a reliable baseline VM is critical to my success in getting farms deployed quickly and easily. To this end I have found that getting a new VM server with the OS installed to the correct level with patches, the SharePoint prerequisites, and all of the customizations that I like to have on a server already installed and ready to go in minutes is pretty important.
This is where Sysprep comes the picture. We have been using Sysprep to prepare images since Windows XP as it allows us to generalize the critical system GUIDs and when the image is launched post-Sysprepping it will create new GUIDs and allow you to re-register the system. While this has always been a recommended practice for deploying the same VM over and over, it has not been a required function until Windows Server 2012.
There are some drawbacks to generalizing a system that you are trying to deploy. For example, once a server has been registered in a SharePoint farm that server cannot be expected to interoperate properly once generalized. Translation: you can't join a SharePoint server to a farm, then do a generalized Sysprep, and expect the new server to be a member of the farm. It is going to have an understandable identity crisis.
For this reason, you will want to do your generalized Sysprep after installing SharePoint & it's patches, but BEFORE doing your PSCONFIG. This will allow you to redeploy the image, set the computer name, a domain and then run PSCONFIG to join the server to the farm. On average this process will take about 15 or so minutes.
Here is how you actually will perform a generalized Sysprep:
1.) Get your image where you are happy with it
Patch your OS. Install the softwares that you want to be able to have already ready to go. I recommend checking out some of my other posts for helpful PowerShell scripts that you will want to run to help you with some of the base OS configurations that you will find useful. "Setup your development machine right" & "Track what you are doing in PowerShell" are two good examples of this.
2.) Take a snapshot of your VM
This will allow you to return to the operational state you are currently in when you finish Sysprepping the image.
3.) From command line run: "c:\windows\system32\sysprep\sysprep.exe"
4.) Choose the option to "Generalize the system"
This is going to remove the GUIDs from the registry and allow you to create new ones upon boot. This will also remove the license key information and require that you re-register with Microsoft when you use the image. This will allow sharing of an image with others without the fear of the licensing police coming after you.
5.) Choose the option to shut down the machine when complete
6.) Click Ok
7.) Once the VM is shutdown make a copy of the VM
It is a good idea to store this in a location that you going to remember what the VM is. It is also a good idea to rename the VM folder & files so that you know that this is a generic image. You will want to give the files a new name each time you redeploy them.
8.) Revert to your pre-Sysprepped snapshot
As previously stated, this will return you to where you were before you started this exercise with an image ready to deploy on.
I hope that this is as useful for you as it has been for me.