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 Microsoft NGen operations, as described at the end of this article.
If using Windows 10 and not running PVS, MCS, 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
- 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. To start, one CD-ROM is assigned.
- 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 will begin 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 vioscsi folder, and choose the folder for your Windows OS.
- After the OS is installed you will need to 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 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
- 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
- Uninstall any dead (ghost) NICs.
If this is a server OS, run the following commands in PowerShell:
Set-ExecutionPolicy Unrestricted Enable-PSRemoting
Run the OS Machine Tools on the OS image
To prepare the OS image to run in a layer, you execute the 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 above directory. 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 or not to use KMS licensing.
In the following dialog box, select whether or not 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 executed.
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 3rd 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.
Open an administrator-level command prompt, and enter the following commands:
cd \windows\Microsoft.Net\Framework\v4.nnnnn ngen update /force
Wait for the command to complete, and enter the following commands:
cd \windows\Microsoft.Net\Framework64\v4.nnnnn ngen update /force
- Exit the command prompt.
Install the App Layering services
Citrix_App_Layering_OS_Machine_Toolsfolder, run the setup_x86.exe (32-bit) or setup_x64.exe (64-bit).
The installation prompts for the location of the unattend file. The unattend file should not be used 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, supercede 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 that will be run when the image is created.
Follow the instructions to run optimizations.cmd on the OS image.
Expedite a Microsoft NGen operation
NGen is the Microsoft Native Image Generator. It is part of the .NET system, and basically recompiles .NET byte code into native images and constructs the registry entries to manage them.
Windows decides when to run NGen based on:
- What is being installed.
- What Windows detects in the configuration.
When NGen is running, you must let it complete. An interrupted NGen operation can leave you with non-functioning .NET assemblies or other problems in the .NET system.
Normally, NGen is a background operation and will pause if there is foreground activity. Bringing the task into the foreground can help the task to complete as quickly as possible.
Force an NGen operation to the foreground
- Open a command prompt as Administrator.
Go to the Microsoft .NET Framework directory for the version currently in use:
Enter the NGen command to execute the queued items:
ngen update /force
This brings the NGen task to the foreground in the command prompt, and lists the assemblies being compiled.
It is okay if you see several compilation messages. You can use Task Manager to see if an instance of MSCORSVW.EXE is running. If it is, you must allow it to complete, or run `ngen update /force.
Do not reboot to stop the task. You must allow it to complete.
- Ensure that all NGen processes have run to completion.
- When complete, you can now shut down the virtual machine.
Prepare your OS image for layering in Nutanix
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 operation