Virtual Machine Template Guidelines for VMWare – “Windows XP”

Following are the guidelines/steps to create a Virtual Machine template for Windows  XP. Please note always start with minimum Specs and then extend later, whenever it required.

Please download below files by click on the file name. It will help you in later configuration.

It’s time to start.

1-First create a new VM

  • Right Click on Server and Choose “New Virtual Machine”
  • Enter VM Name (according to defined naming convention) and Inventory Location
  • Select Datastore
  • Select Virtual Machine Version: select latest available
  • Select “Microsoft Windows XP (32/64-bit)” as OS Version
  • # of Virtual Processors: 1
  • Amount of RAM: 1GB
  • Network
    • # of NICs: 1
    • Adapter Type: VMXNET 3
    • Select “Connect at Power On”
  • SCSI Controller: LS Logical Parallel
  • Create New Virtual Disk: 15GB
    • Disk Provisioning: Thin Provision
  • Virtual Device Node: SCSI (0:0)

NOTE: Thin Provision is good practice to store templates files. because, it will save some storage space.

2-Now prepare the virtual hardware

  • Right click on VM ->Hardware Upgrade(If Applicable)
  • Edit VM Setting ->Select Floppy drive->
    • Go to data store-> vmimages->floppies->Select “LSI-Logic-Driver-XP.flp”
    • Select “Connect at Power On”
  • Edit VM Settings > Options->VMWare Tools->Advanced->
    • Check upgrade Tool during power cycling checkbox
    • Check synchronize guest time with host checkbox
  • Edit VM Settings->Memory /CPU Hot plug (enable, which is supported)
  • Edit VM Settings->Advance->General Section ->Uncheck “Enable logging”

3-Virtual Machine Disk Alignment

 Aligning the file system of a VM increase the I/O efficiency from the NTFS file system to the underlying storage, creating a VM within VCenter automatically aligns the VMFS but the guest file system must also be aligned.

 Windows XP does not provide a method for creating aligned file system during installation. to work around this, the VM file system can be accessed using fdisk from the ESXi console, this goal is to set the beginning offset for the file system to sector 128, this has (128 sectors x 512 bytes/sector=64k), please follow the below steps to achieve this.

  • Log in to the console using SSH of the ESXi Server hosting the Template virtual machine
  • Go to the datastore where virtual machine resides
  • Here in this example, in our case VM machine name is “Win_XP_32_temp_01” and he resides on SAN 3TB datastore, in your case it will be different and you will choose accordingly.

# Cd /vmfs/volumes/SAN-3TB/
# Cd Win_XP_32_temp_01 (go to the VM directory, in our example it is “Win_XP_32_temp_01”)

  • View the VMDK file parameters by typing cat

#cat Win_XP_32_temp_01.vmdk |grep -i ddb.geometry.cylinders
Note: the ddb.geometry.cylinders value. In this example it is 1044

  • Edit the “–flat” virtual disk file of the VM using fdisk .

#fdisk ./ Win_XP_32_temp_01-flat.vmdk
Enter in expert mode by typing “x” and then “c” to enter the number of cylinders equal to the value of “ddb.geometry.cylinders”, which was “1044” in this example.

value of “ddb.geometry.cylinders”, which was “1044” in this example.

Command (m for help): xExpert command (m for help): c
Number of cylinders (1-1048576, default 1044): 1044

The number of cylinders for this disk is set to 1044.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
  • Type “r” to return to normal mode
  • Type “n” for new partition, select “p” and then type “1” to select the first partition and “1” to set the first cylinder and press enter

The default value for the last cylinder, which should be equal to the “ddb.geometry.cylinders”, appears

Expert command (m for help): rCommand (m for help): nCommand action   e   extended
 p   primary partition (1-4)pPartition number (1-4): 1
First cylinder (1-1044, default 1): Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1044, default 1044): Using default value 1044
  • While still in the expert mode , type “b” to specify the beginning offset for the disk and the type “1” to specify the first partition and set the new beginning of data to 128
  • Type “p” to view the partition table and ensure the “start” has the correct value 128
Command (m for help): xExpert command (m for help): bPartition number (1-4): 1New beginning of data (0-16771859, default 63): 128Recalculate C/H/S values? (Y/N): YExpert command (m for help): pDisk ./WinTest-flat.vmdk: 255 heads, 63 sectors, 1044 cylindersNr AF  Hd Sec  Cyl  Hd Sec  Cyl      Start       Size ID 1 00   2   3    0 254  63 1023        128   16771732 83
 2 00   0   0    0   0   0    0          0          0 00
 3 00   0   0    0   0   0    0          0          0 00
 4 00   0   0    0   0   0    0          0          0 00
  • Type “r” to return to the normal mode
  • Type “t” to specify the partition type.
  • Type “7” to set the partition type to NTFS and then type “w” to write the partition table to disk
Expert command (m for help): rCommand (m for help): tSelected partition 1Hex code (type L to list codes): 7Changed system type of partition 1 to 7 (HPFS/NTFS) Command (m for help): wThe partition table has been altered.Calling ioctl() to re-read partition tablefdisk: WARNING: rereading partition table failed, kernel still uses old table: Inappropriate ioctl for device

4-OS Configuration

  • Edit VM Settings->Remove Extra Hardware(USB & floppy etc)
  • Power on the VM and Install Windows XP 32/64bit
  • As it gets boot, while installation, if windows does not detect hard disk then reboot the VM and select “F6” at installation, follow the instructions and install “SCSI” drivers. 
  • Once installed shutdown the VM and go to “Edit VM Settings”->Boot Options > Select “Check box to force going into the BIOS on next boot”
  • Power on the VM (will go directly to BIOS) > Advanced > I/O Device Configuration:
    • Disable Serial port A
    • Disable Serial port B
    • Disable Parallel port
    • Disable floppy drive
  • Disconnect Windows 2k3 ISO and set “device type” to “Client Device”
  • Power on the VM and install VMware Tools-> While installation choose “Custom Install Type” and select all components
  • Set Windows “Time Zone” and time configuration.
  • Install any Windows Update and Service Pack
  • add static route (if required). below is an example, edit it according to you needs)
    • cmd: route add 172.17.0.0 mask 255.255.0.0 10.0.9.2 –p
    • cmd: route print(to verify route)
  • Enable “remote desktop”, uncheck “remote assistance”
  • In Control Panal->Windows Firewall->Add “remote desktop” in exception list.
  • Install “.Net Framework” and “Java” (if required)

5-Create Snapshot

  • Create snapshot for safe side in case anything goes wrong in later configuration
    • Snapshot name->(Win_XP_32bit_Snap01_Date and Time) and add description(FRESH OS INSTALLATION with basic configuration)

6-Network Configuration

  • From Control Panel-> Network Connections->Right click on Local Area Connection and select properties->Uninstall QoS Packet Scheduler
  • ** We don’t do QOS at the OS level, our switches do that.
  • Control Panel->windows firewall->advanced->ICMP Settings->check allow incoming echo request->ok

7-Control Panel Settings

  • Control Panel ->Switch to Classic view
  • Power Options
    • Change plan settings -> Turn off the harddisk -> Never
  • Control Panel -> Sound and Audio Device-> Sound-> Sound Scheme: No Sounds
    • Pop-up: “Would you like to enable the Windows Audio Service?” – No->
    • In volume tab->Uncheck “Place Volume Icon in the Taskbar”
  • Control Panel -> Display ->
    • Change screen saver ->set screen saver as none
  • Internet option->
    • general->set blank
    • security->trusted sites->add sngpl.com.pk,sngpl.net
    • Connection->Lan Setting->uncheck auto detect setting
    • Advanced->Security->
      • EMPTTY Temporary internet file folder when browser is closed
      • Check for server certificate revocation
  • Control Panel -> Folder Option ->
    • Select “Show hidden files, folders and drives”
    • Uncheck “Hide extensions for known file types”
    • Check “Display the full path in the title bar”
    • Select Offline files
    • Uncheck enable offline files
  • Control Panel->Systems
    • Advance->Adjust for best performance
    • Advance->Error Reporting->Disable Error Reporting
    • Advance->Startup and Recovery->
    • Uncheck time to display list of operating systems
    • Set 5 sec in time to display recovery options when needed
    • System Restore->Turn off System Restore
    • Automatic Updated->Turn Off
  • Control Panel->Taskbar and Start Menu
    • Start Menu->Classic Start Menu->Check Show small icons in start menu
  • Control Panel->Add or Remove Programs->Add/Remove Windows Components
    • Accessories and utilities->Uncheck Games
    • Uncheck msn explorer
    • Uncheck Outlook express
    • Uncheck windows messenger
    • Uncheck windows media player
  • Control Panel->Printer and Faxes->file menu->Server Properties->Advanced->uncheck all logs related options

8-System Performance

  • Turn off indexing- >Go to “C:” Drive-> Properties -> General
    • Uncheck “Allow indexing service to index this disk for fast file searching”
    • Choose Apply -> Apply changes to C:\ only (or files and folders, to taste)
  • Disable the language bar
    • Cmd:regsvr32 /u msutb.dll
  • Purge Windows File Protection DLL Cache(run these command through VM Console)
    • Cmd: sfc /purgecache
    • Cmd: sfc /cachesize=0

9-Create Snapshot

  • Create snapshot for safe side in case anything goes wrong in later configuration
    • Snapshot name->(Win_XP_32bit_Snap02_Date and Time) and add description(Customization 1-ControlPanel, Network And system performance)

10-User Profile Settings

In Windows XP, Microsoft has disabled the Copy To.. Button on the User Profiles screen.

This issue is known to Microsoft but no fix has been released yet, but luckily there is an alternate way to achieve this.

  • You can download a tool called ‘Windows Enabler ‘from the below link or save from attachment of this document at start.
  • http://www.freewarefiles.com/downloads_counter.php?programid=980
  • Save the file to your Template VM’s desktop and extract the file.
  • Right click on “.exe“ file.
  • Once you have started the Windows Enabler application you will notice a new icon in the system tray
  • Make sure you click on it once to enable the application.
  • In the ‘Run’ prompt type cpl and hit Enter
  • Navigate to ‘Advanced’ tab -> User profiles -> Settings
  • Click on the desired profile and you will notice that ‘Copy To‘button is disabled.
  • Now, click on the disable button and it will become enabled thanks to ‘Win Enabler’ application.
  • Now copy the profile (in our case, it would be the user which we are using for configuration in most case it is administrator) to “Default users”(C:/Documents and Settings-/Default Users) profile.

11-Create Snapshot

  • Create snapshot for safe side in case anything goes wrong in later configuration
    • Snapshot name->(Win_XP_32bit_Snap03_Date and Time) and add description(Customization 2-After Profile Configuration)

12-Registry Settings

  • Disable paging the executives
  • Disable the windows prefetcher
  • Launch windows Desktop as a separate process
  • TCP/IP connections retransmission
  • Disable system crash dump file
  • Automatically reboot on the blue screen of death

NOTE: The downloaded attachment “XP-RegistrySettings.txt” from this document at start. place in C Drive. Rename from .txt to .cmd, to automatically configure all registry settings, double click and execute .cmd file.

13-Create Snapshot

  • Create snapshot for safe side in case anything goes wrong in later configuration
    • Snapshot name->(Win_XP_32bit_Snap04_Date and Time) and add description(Customization 3-After Registry Settings)

14-Disable Swapping & Disk Defragmentation

  • From Control Panel select Change System Properties->Select Advanced Tab->performance->Advance->Virtual Memory->Change
    • Select “No paging file”
    • Click “Set” to disable swap file
    • Select C Drive->properties->Tools->Disk Defragment->Defragment

15-Test Alignment

  • After installation, copy the “VM Check Alignment.zip” (Which downloaded from start on this post) file to “C” drive of the VM.
  • Unzip it
  • Run the .exe file and enter “localhost” in the computer name
  • Press check alignment button to verify the alignment status of the disk.

16-Finalizing

  • Control Panel->Internet Options->General
    • Delete cookies
    • Delete files
    • Clear history
  • Delete the contents of C:\Windows\Temp Folder
  • Delete any unused files/folders in the system
  • Place XP-ServicesSetting.txt on “C” Drive, Rename with “XP-ServicesSetting.cmd”.
  • Save downladed “ntregopt.zip” file and place in C Drive then unzip and run exe file.
  • Custom(initially 1500, maximum2000->set)
  • Control Panel->System->Advance -> Performance -> Settings… ->
    • Advanced -> virtual memory->change
  • Enable Swap files
  • Control Panel->Taskbar and Start Menu->Start Menu->Classic Start Menu->customize->clear->ok
  • Control Panel->Administrative tools->Event Viewer(clear all events)
  • Join Domain (optional), it is optional because windows customization wizard will automatically join domain to every vm.
  • Empty Recycle Bin
  • cmd: ipconfig /release
  • Shutdown

17-Create Snapshot

  • Create snapshot for safe side in case anything goes wrong in later configuration
    • Snapshot name->(Win_XP_32bit_Snap05_Date and Time) and add description(Customization 4-Final Configuration Except Antivirus)

18-Install Antivirus (optional)

  • It is the time to install an antivirus security. It’s optional, if you may want to install one.

19-Convert VM to Template

Use the VMware Customization Wizard to create a re-usable script for cloning the template. Now’s a good time to test that your template will create a usable clone and make sure while creating a production VM from template choose “disk provision” method from “thin provision” to “thick provision”.

vmtemplate-xp01

Add below setting in Run Once in Customization wizard (This step is optional. you may configure it according to you environment)

Run Once:

  • c:\XP-ServicesSetting.cmd (which downloaded from this post at start)

vmtemplate-xp02

————————————————————————————————————————–

Following service will be disabled in Run once script.

Shell Hardware Detection SSDP Discovery Service Task Scheduler
Windows Zero Configuration Computer Browser Help and Support
IPSEC Security Center Telephony
Indexing Service Remote Registry Themes
System Restore Service Error Reporting Print Spooler
Network Location Awareness Windows Audio  

NOTE: It’s time you may deploy VM from the template.

20-Optional Steps ( align non-OS Disk)

This scenario is only apply, if you want to add another drive (D) in your existing VM. Then follow the below steps to align the partition

  • Shutdown the VM->Edit VM Setting-> add another disk-> power on the VM.
  • Go to Disk manager (Control panel->Administrative Tools-> Computer management->initialized the disk (Do not create any partition)
  • Install the Diskpart on your VM (which you have download at the start of this post)

Example:

Here is an example in which the D: drive is created on disk 1, aligned with an offset of 1,024 KB, and formatted with a file allocation unit (cluster) size of 64 KB.

Make sure “D” drive latter is free.

Command syntax

  1. Diskpart
  2. list disk
  3. select disk <DiskNumber>
  4. create partition primary align=<Offset_in_KB>
  5. assign letter=<DriveLetter>
  6. format fs=ntfs unit=64K label=”<label>” nowait 

Example

Open a command prompt, type diskpart

C:\>diskpart

Microsoft DiskPart version 6.0.6001

Copyright (C) 1999-2007 Microsoft Corporation.

On computer: ASPIRINGGEEK

DISKPART> list disk

  Disk ###  Status      Size     Free     Dyn  GPT

  ——–  ———-  ——-  ——-  —  —

  Disk 0    Online       186 GB      0 B

  Disk 1    Online       100 GB      0 B

 

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> create partition primary align=1024

DiskPart succeeded in creating the specified partition.

DISKPART> assign letter=D

DiskPart successfully assigned the drive letter or mount point.

DISKPART> format fs=ntfs unit=64K label=”My Data Disk” nowait

NOTE: Diskpart default procedure as showed above only works for basic disks

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s