The support that VMware VirtualCenter provides for using Sysprep to clone Windows virtual machines (VMs) is a key part of VMware’s quick provisioning functionality. While VirtualCenter provides a means for creating unattended answer files (via Customization Specifications), it does not provide a way to allow users to customize the Sysprep.inf that is generated by VirtualCenter. Of course, that is not to say that such customization isn’t possible, just that there isn’t a pretty graphical interface provided for it. Fortunately, the process for customizing the Sysprep.inf isn’t too terribly difficult.
Using information provided by this Virtrix post, I managed to customize the Sysprep.inf. A recent Virtual Desktop Infrastructure (VDI) project on which I was working called for VMs to have small Windows pagefiles, but Sysprep kept resetting the pagefile size to the default. In this case, the default was much larger than the customer desired, so we needed a way to tell Sysprep not to resize the pagefile.
The first step in customize the Sysprep.inf is to decode the VBScript files used by VirtualCenter. This script decoder works wonderfully, producing unencoded script files that can be easily edited. Be sure to backup the original files first in the event you run into a problem! Here’s the commands I used to decode the scripts, which are located in C:\Program Files\VMware\VMware VirtualCenter 2.0\scripts:
move autoprep.wsf autoprep.wsf.backup
move gensysprepinf.vbs gensysprepinf.vbs.backup
scrdec18 autoprep.wsf.backup autoprep.wsf
scrdec18 gensysprepinf.vbs.backup gensysprepinf.vbs
First, I moved the originals to a backup file, then used the backup file as the source for decoding to a new file with the original name.
Once the files are decoded, you can then edit gensysprepinf.vbs to add or remove entries from the Sysprep.inf that is generated by VirtualCenter. In Vincent’s example, he had to modify the default regional settings; in my case, I needed to change the behavior of Sysprep with regards to the pagefile. I modified the following section:
outStr = “[Unattended]†& vbCrLf _
& “ OemSkipEula=Yes†& vbCrLf _
& “ InstallFilesPath=\sysprep\i386†& vbCrLf _
& “ KeepPageFile=1†& vbCrLf _
That last line “KeepPageFile=1â€, was what I added to tell Sysprep to leave the existing pagefile alone. That line isn’t perfect, though; this Microsoft KB article describes how it works. In our case, it was enough.
Once that’s done, I had to edit autoprep.wsf to indicate that the gensysprepinf.vbs file is no longer encoded. I had to edit the line that referenced gensysprepinf.vbs:
<script language=“VBScriptâ€
src=“gensysprepinf.vbsâ€>
The key change here is from “VBScript.Encode†to “VBScript†for the language parameter. This is detailed in Vincent’s post as well. That’s it! Of course, you could edit the scripts far more extensively, if so desired.
Thanks to Vincent for a great post; without his post, I wouldn’t have known where to start. It also looks like Jase McCarty used the same technique in extending the VM’s root partition; although I didn’t read his paper I would guess the same mechanisms are involved.
Tags: Microsoft, VDI, Virtualization, VMware, Windows


3 comments
Comments feed for this article
Trackback link
http://blog.scottlowe.org/2007/11/16/customizing-the-sysprepinf-created-by-virtualcenter/trackback/
Monday, January 14, 2008 at 10:08 am
Wayne
I’ve been using this for sometime - modification of the sysprep files, etc. I insert some files of my own at the end of the build. Any idea how to do this in VC2.5? It appears they changed some things…
Wednesday, June 18, 2008 at 4:47 am
memey
I want to make an image with my OS. i use sysprep. Can i determine the IP address and ptinter setting in sysprep?? (before install and image in new PC, we must enter IP address and wich printer are use?) tahnk youu
* can i receive the answer to email??
Wednesday, June 18, 2008 at 7:42 am
slowe
Wayne,
Sorry, I should have responded sooner to your comment. I haven’t yet figured out how to do this in VC2.5, either. Still working on that one!
Memey,
There are better resources out there than this site for questions relating specifically to Sysprep. Have a look at this Google search for some pertinent sites:
http://www.google.com/search?hl=en&q=how+to+use+sysprep
Hope this helps!