Friday, April 27, 2012

Optimize Windows XP/2003 for use in VM


In my day-to-day life, I regularly use virtual machines for system testing, development, etc. The need for having several VM working simultaneously enforces me to optimize them to the fullest extend (I'm also a tuning freak, so...).

Over the years, I've managed to gather some regular task in optimizing VM's through the command line (I'm from *NIX school). They were primarily developed for use in VMware (Fusion, ESX, ESXi) but I think it may applies to any kind of virtualization:

The basics:

Disable the update of file access time since its an unnecessary overhead:
fsutil behavior set disablelastaccess 1

Disable power management since the host will manage this for you:
powercfg /setactive "Always On"
powercfg /h off

Disable logon screensaver, otherwise you loose CPU cycles when the machine is on Logon Screen:
reg add "hku\.DEFAULT\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d "0" /f

Configure Windows Time not to sync with NTP, it's preferable to sync with the host:
reg add HKLM\SYSTEM\CurrentControlSet\Services\W32time\Parameters
/v Type /t REG_SZ /d "NoSync" /f


If you're using recent versions of VMware whatever, run the following command to active Time Synchronization with the host:
"C:\Program Files\VMware\VMware Tools\vmwaretoolboxcmd.exe" timesync enable

The moderate

Disable unneeded services with the following commands:

net stop [service name] (it stops the service)
sc config [service name] start= disabled (it disables the service but don't forget the space after =)

The services that I usually disable (usually for standalone machines) are:
  • ALG (Application Layer Gateway Service)
  • Alerter
  • AppMgmt (Application Management)
  • Clipbook
  • Browser (Computer Browser
  • TrkWks (Distributed Link Tracking Client)
  • ERSvc (Error Reporting Service)
  • HelpSvc (Help and Support)
  • HidServ (Human Interface Device Access)
  • PolicyAgent (IPSEC)
  • Messenger
  • nmnsrvc (NetMeeting Remote Desktop Sharing)
  • NetDDE (Network DDE)
  • NetDDEdsdm (Network DDE DSDM)
  • WmdmPmSN (Portable Media Serial Number Service)
  • Spooler (Print Spooler)
  • RasAuto (Remote Access Auto Connection Manager)
  • RasMan (Remote Access Connection Manager)
  • RDSessMgr (Remote Desktop Help Session Manager)
  • RemoteAccess (Routing and Remote Access)
  • wscsvc (Security Center)
  • ShellHWDetection (Shell Hardware Detection)
  • SSDPSRV (SSDP Discovery Service)
  • srservice (System Restore Service)
  • TapiSrv (Telephony)
  • Telnet
  • Themes
  • W32Time (Windows Time)
  • WebClient
  • AudioSrv (Windows Audio)
  • WZCSVC (Wireless Zero Configuration)
  • SharedAccess (Windows Firewall/Internet Connection Sharing)

The Heavy ones (for the pro's)

First of all, this part is for people who know what they are doing. Otherwise, it can do more harm than good...

Give enough memory to the VM so it does't need to swap, and then set a fixed size for the page file (change 512 value below to your VM's memory configuration):
reg add "hklm\System\CurrentControlSet\Session Manager\Memory Management"
/v PagingFiles /t REG_MULTI_SZ /d "c:\pagefile.sys 512 512" /f


Disable Paging Executive so it doesn't keep paging unused memory (we hope to avoid disk I/O which heavily penalizes VM performance):
reg add "hklm\System\CurrentControlSet\Session Manager\Memory Management"
/v DisablePagingExecutive /t REG_DWORD /d 0x1 /f


Summary

There are more things (TCP/IP windows stack tuning, other parameters tuning etc.) that I could add to this post, but I guess I'll save for later...

First, I need to find out how to put tables (without going through the HTML) in this blog thing!

Be right back!

No comments:

Post a Comment