Creating a Windows Server 2016 template with VMM

New year, new operating system: Windows Server 2016 was released to general availability in October, but if you haven’t yet taken the plunge, it is time to start preparing your corporate environment to support the new OS.

To provision a new Windows Server 2016 VM (virtual machine), we need at least Cumulative Update 11 plus Hotfix 1 in System Center 2012 R2 Virtual Machine Manager (SCMM). This hotfix will support Windows Server 2016 Guest OS. In case you want Windows Server 2016 hosts, then the best approach is to upgrade to Virtual Machine Manager 2016.

If you are a VMware shop, then the minimum requirement is ESX 5.5 to support Windows Server 2016 Guest OS. VMware has a very good resource page to check compatibility.

Preparing the Windows Server 2016 image

These steps will work for any virtualization product out there, and we are going to cover some best practices when preparing the VM that will be used as template:

  • Install Windows Server 2016 using default settings
  • Run Windows Update on the new server and make sure that all updates were applied
  • Do not install AV or any additional software
  • Avoid using static IPs! Leave DHCP and default settings
  • Do not disable IPv6 on the template
  • Create an additional account on the VM and add this account as a member of the local administrator group
  • Do not join the Template VM into a domain
  • If you have a static image for your lock screen, you can add to the image as well
  • If you are responsible for production and are worried about performance, you may want to consider static disks to host the C: drive of the servers
  • Make sure to clean up all event logs right before starting the SysPrep process

A few hints to save you time

You can always go to Windows Server and manually and start cleaning up the log files, but be forewarned: If you try to clean up the Applications and Services log, you will spend at least a couple of hours to clean all the entries.

Fortunately, there is a faster way to do it. Using the wevtutil utility with PowerShell as administrator, run the command with the parameter el, which will enumerate all log files in use locally, and then on the second statement we will use cl, which is the clear-log parameter. Basically, the following line of command will delete all logs of every single log:

Wevtutil el | ForEach { wevtutil cl “$_”}

 

01

You may want to configure pagefile as part of the provisioning process. If you do so, you can add some .bat and diskpart command-line to automate the process. In the example below, we have a bat file that calls a pagefile.txt file that has all the commands to format and assign a drive letter to a new volume, and after that, a wmic command to define the pagefile on the new volume created for that purpose.

04

After preparing the template VM, the next step is to run Sysprep (you can go to Start / Run and type sysprep, or go to \Windows\System32\Sysprep and run the .exe from there). The System Preparation Tool (SysPrep) should be configured to Shutdown the server and Generalize must be checked. After clicking on OK, wait a few minutes and wait for the VM to shut down completely before moving forward.

05

Creating the VMM template

The first step is to copy the VHDX file from the virtual machine to the VMM Library folder; in our example we rename the file to WS2016-OS.vhdx.

Note: The name of this VHDX file will be the same name that will show up on the VMs created from this template. It is recommended to use a standard name for the file itself and add the versioning inside of VMM.

clip_image007

The second step is to refresh the VMM Library where the file was copied over, and then get the properties of that file, change the name to match the file name, assign a Family, Release, Operating System, and Virtualization Platform.

image

My recommendation is to have a hardware profile in place before creating a template where the administrator can define CPU, memory, LAN, Availability, checkpoints, and cloud capabilities, and assign that to a new template instead of doing that manually. A second recommendation is to use a Guest OS Profile where the administrator can define the local administrator password, time zone, domain-joining process, additional scripts when provisioning the server, and product key. (If you are provisioning with KMS, check this page.)

After having these two items above defined, the process to create a template using VMM is straightforward. The first step is to find the VHDX that we already copied to the VMM Library, right-click on it and then click on Create VM Template.

15

In the Identity page, define a name for the new template, and select the generation (we will be using Generation 2), click Next.

In the Configure Hardware page, select the hardware profile created previously, which contains all the hardware information, and click Next.

In the Configure Operating System page, select a Guest OS Profile. Because you already created this (see above), it will come with all settings populated. Click Next.

In the Application Configuration page, keep the default settings and click Next.

In the SQL Server Configuration page, keep the default settings and click Next.

In the Summary page, click on Create to start the Template creation. The process will take just a few seconds.

To test the results, create a new virtual machine, and on the initial page of the wizard click on use an existing virtual machine, VM Template, or virtual hard disk and select Browse. Finally, select the Template that was just created and complete the wizard leaving the default settings. That will provision a brand new Windows Server 2016 based on our template.

image

 

Happy New Year, and, hopefully, happy new server.

Photo credit: Pixabay

2 thoughts on “Creating a Windows Server 2016 template with VMM”

  1. in your instructions you mention to not install AV or other tools? Was hoping to set up a server 2016 VMM16 template which would already have AV, RSA for our environment to skip a step in our building process. Is there no way to do this?

Leave a Comment

Your email address will not be published.

Scroll to Top