Prepare your OS image for layering in Nutanix
This topic explains how to prepare a clean OS image for import into a new OS layer. Before you start, make sure that you meet the requirements. While preparing the image, you can Expedite a Microsoft Ngen.exe operation, if necessary, if you think it is taking too long.
If using Windows 10 and not running PVS, machine creation, or View, you can speed up desktop start times by removing Windows 10 built-in applications. However, we recommend removing the apps on a new version of the OS layer, not in the OS image itself.
Do not use an unattend file in Nutanix. The App Layering software removes the unattend file if it is present, because it is not necessary or recommended in Nutanix.
Install the OS on a virtual machine
As part of this procedure, you can set up Key Management Service (KMS) activation.
Note: Publishing images into environments where both KMS and Active Directory-based activation(ADBA) are being used at the same time causes problems with activation.
- Log into the Prism Console.
- Select Task > VM, and switch to Table View to see the existing virtual machines.
- Click +Create VM in the upper right corner, and enter the specifics about the new virtual machine:
- Enter a Name and add a Description.
- Select the number of VCPUs.
- Set the Cores per CPU.
- Set Memory.
- Select Disks, and create a virtual machine with three disks. The first CD-ROM is the ISO for the OS. The second CD-ROM is for the Nutanix VIRTIO drivers that allow the Nutanix virtual machine to access the disk where you install the OS. One CD-ROM is assigned in the beginning.
- Edit the values for the assigned CD-ROM:
- For Operation, select Clone from ADSF file.
- For Bus Type, select IDE.
Enter the path to your Windows ISO. The path is the combination of the Storage Container and the ISO Name. For example:
- Click Update.
- Add another disk by clicking the +Add New Disk button:
- Set the Type to CDROM.
- Set the Operation to Clone from ADSF file.
- Set the Bus Type to IDE
Enter the path to the Windows VIRTIO Drivers. For example:
- Click Add.
- Click the +Add New Disk button.
- Set the Type to Disk.
- Set the Operation to Allocate on Container.
- Set the Bus Type to SCSI.
- Select the Container you want to use.
- Enter the Size.
- Click Add.
- Click +Add new Nic, and enter the VLAN Name.
- Click Save.
- Power on the virtual machine.
- Select Tasks > VM.
- Switch to the Table View to see existing virtual machines.
- Select the virtual machine in the Table, and click Power On.
- Launch the console by selecting the VM and clicking Launch Console. When the VM boots it begins to install the Windows OS from the ISO disk. When the VM boots, it begins to install the Windows OS from the ISO disk.
- When asked, “Where do you want to install Windows?” notice that even though you added a disk in the VM creation wizard, there is no disk.
- Select the Load Driver option, and select Browse.
- Select the CD with the virtio-win-0.1.1 drivers.
- Select the
vioscsifolder, and choose the folder for your Windows OS.
- After the OS is installed manually install the VirtIO drivers:
- Launch Device Manager.
- Select Other Devices, right-click Ethernet Controller and choose Update Driver Software.
- Browse My Computer, and choose the VirtIO CD. The Ethernet drivers are stored in the NetKVM folder.
Server OS: If you need a session host feature:
- Select Add roles and features.
- For the Installation Type select Feature-based installation.
- For the Server Role, select Remote Desktop Services > Remote Desktop Session Host.
- Complete the process of adding server roles.
- Install all important updates. Restart the system and check for more updates. Some updates only become available after others are installed.
- Install all required service packs.
- Install all required hot fixes: Windows Server 2008 R@ SP1 and Windows 7: Install KB2550978 for PVS
- Disable Windows System Restore and Windows Automatic Updates.
- Enable built-in administrator and check Password never expires.
If using Key Management Service (KMS) licensing, run a command window as Administrator, and enter these commands:
slmgr /skms <kmsserverhost> slmgr /rearm reboot slmgr /ipk XXXX-YOUR-KMS-KEY-XXXX slmgr /ato <!--NeedCopy-->
- Server OS: Add Domain Users to Remote setting for server OS.
Check for dead (ghost) NICs and delete if any exist. Enter the commands:
set devmgr_show_nonpresent_devices=1 devmgmt.msc <!--NeedCopy-->
- Uninstall any dead (ghost) NICs.
If this is a server OS, run the following commands in PowerShell:
Set-ExecutionPolicy Unrestricted Enable-PSRemoting <!--NeedCopy-->
Run the OS Machine Tools on the OS image
To prepare the OS image to run in a layer, you run the OS Machine Tools file on the image. This executable runs a GPO setup script (gposetup.cmd), and a Set KMS Version script (SetKMSVersion.hta).
Download the following executable file onto the OS image:
Run the executable. Files are saved to:
The file must be extracted to the
c:\windows\setup\scriptsdirectory. Do not change the directory.
If using Key Management Service (KMS), configure license activation
Once the scripts are extracted, the SetKMSVersion utility asks you to choose whether to use KMS licensing.
Note: Publishing images into environments where both KMS and Active Directory-based activation (ADBA) are being used at the same time causes problems with activation.
In the following dialog box, select whether to use Key Management Service (KMS) licensing.
To configure scripts for KMS, do the following.
Run SetKMSVersion.exe as Administrator. This creates a script file in the
When the operating system starts, the appropriate KMS activation script is run.
Make sure the correct versions of .Net Framework are installed (Windows 7, Windows 10, Windows Server 2016)
The .Net Framework is a software framework provided by Microsoft, and it is required for many third party applications to run.
- /.NET Framework 4.5: Required on Windows 7.
- /.NET Framework 3.5: Required on Windows 10 and Windows Server 2016.
To install .NET Framework:
- On the Start menu, select Control Panel > Programs and Features.
- In the left panel select Turn Windows features on or off. A window opens.
Select the correct version of .NET Framework, click OK, and wait for the installation to complete.
Even if .NET is already installed, continue with the rest of these steps.
- Exit the Control Panel.
- In Notifications in the right-side of your taskbar, click All Settings, and open the Windows 10 Settings app.
- Select Settings > Update & Security.
- Check for updates, and install all updates available.
- Exit Settings.
Install the App Layering services
c:\windows\setup\scriptsfolder, run the setup_x86.exe (32-bit) or setup_x64.exe (64-bit).
The installation prompts for the location of the
unattendfile. Do NOT use the
unattendfile in Nutanix.
Run the Optimization script, if using MS Office
The Optimization script included in the App Layering installation package is required to layer Microsoft Office. This script allows you to save memory and CPU by disabling services you don’t need, enabling services you do need, and removing installation-specific drivers and settings.
You can run the Optimization script on the OS layer, and if needed, supersede it with a new version of the script in an App layer included in your image template. Since App layers are applied to the image after the OS layer, the script in the App layer overrides the original version in the OS layer.
c:\windows\setup\scriptsfolder, run the optimizations.cmd file to create a file to run when the image is created.
Follow the instructions to run optimizations.cmd on the OS image.
Expedite a Microsoft Ngen.exe operation, if necessary
Once all software updates have been installed, you must allow
Ngen.exe to essentially recompile
.NET byte code into native images and construct the registry entries to manage them.
Ngen.exe is the Microsoft Native Image Generator, which is part of the
.NET system. Windows determines when to run
Ngen.exe based on what software is being installed and what Windows detects in the configuration.
Ngen.exeis running, you must let it complete. An interrupted
Ngen.exeoperation can leave you with non-functioning
.NETassemblies or other problems in the
Ngen.exe is a background operation that pauses when there is foreground activity. If you want to expedite an
Ngen.exe operation, you can bring the task into the foreground to complete it as quickly as possible.
To bring the task into the foreground:
- Open a command prompt as Administrator.
Go to the
Microsoft.NET\Frameworkdirectory for the version currently in use:
cd C:\Windows\Microsoft.NET\FrameworkNN\vX.X.XXXXX <!--NeedCopy-->
Enter the following
Ngen.execommand to run all queued items. This command processes queued component installs before building assemblies.
ngen eqi 3 <!--NeedCopy-->
Ngen.exetask moves to the foreground in the command prompt, and lists the assemblies being compiled. It is OK if you see compilation messages.
You can use the Task Manager to see if an instance of
MSCORSVW.EXEis running. If it is, allow it to complete, or run
ngen update eqi 3.
Caution: Do not reboot to stop the task. Allow the task to complete!
- Ensure that all
Ngen.exeprocesses have run to completion.
In this article
- Install the OS on a virtual machine
- Run the OS Machine Tools on the OS image
- If using Key Management Service (KMS), configure license activation
- Make sure the correct versions of .Net Framework are installed (Windows 7, Windows 10, Windows Server 2016)
- Install the App Layering services
- Run the Optimization script, if using MS Office
- Expedite a Microsoft Ngen.exe operation, if necessary