Replace Answer File with Template
Using “vmutils” tool that is available here [link TBD], mount copied VHD:
vmutils MountVHD –path “c:\VPS\Templates\Windows 2008 Standard x64.vhd”
Open “Computer Management” snap-in and expand “Disk Management” node. Bring mounted disk online (if it’s offline):
Alternatively, you could make the disk online and clear volume “readonly” attribute (if set) by using DiskPart utility:
From command line:
C> DiskPart
Display all available disks:
list disk
Select required disk by specifying its index:
select disk=<N>
Bring selected disk online:
online disk noerr
List all volumes:
list volume
Select volume by specifying its index or drive letter:
select volume=<N>
Clear readonly flag:
attributes volume clear readonly noerr
Exit from DiskPart:
exit
In Windows Explorer open “Windows\System32\sysprep” folder on mounted disk.
Download “Sysprep Files for Windows Server 2008” from here [link TBD] and unpack it to some folder.
Replace contents of “unattend.xml” file in “Windows\System32\sysprep” folder of mounted disk with “unattend-template.xml” from archive.
You can use provided template as a starting point for your own and add any additional settings specific to your hosting company. Do not edit template in WSIM as with template instructions it is in valid XML and thus won’t be loaded by WSIM. Use Notepad or any other text editor. You could find the list of all available template variables in WebsitePanel Hyper-V Module Setup Guide.
Also, please note that provided template does not include “ProductKey” element, so you will need to add it in order to skip “Enter product key” dialog during “specialize” pass of Windows Setup. “ProductKey” element must be inserted inside “Microsoft-Windows-Shell-Setup” component, for example:
<component name="Microsoft-Windows-Shell-Setup" ...>
<ComputerName>#vm.Hostname.ToUpper()#</ComputerName>
<RegisteredOwner>#user.FirstName# #user.LastName#</RegisteredOwner>
<RegisteredOrganization>#user.CompanyName#</RegisteredOrganization>
<TimeZone>Eastern Standard Time</TimeZone>
<ProductKey>AAAAA-BBBBB-CCCCC-DDDDD-EEEEE</ProductKey>
</component>
Alternatively, in order to test VPS template you could setup template to skip Windows Activation by omitting “ProductKey” element and inserting “Microsoft-Windows-Security-Licensing-SLC-UX” component into answer file:
<settings pass="specialize"> <component name="Microsoft-Windows-Security-Licensing-SLC-UX"
processorArchitecture="#architecture#" publicKeyToken="31bf3856ad364e35"
language="neutral" versionScope="nonSxS"
xmlns:wcm=http://schemas.microsoft.com/WMIConfig/2002/State
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SkipAutoActivation>true</SkipAutoActivation> </component> ... </settings>
Help page for “ProductKey” element: http://technet.microsoft.com/en-us/library/cc749389.aspx
Help page for “SkipAutoActivation” element: http://technet.microsoft.com/en-us/library/cc749137.aspx
Please note, that “ProductKey” and “SkipAutoActivation” elements should not be added both in the answer file, but only one of them: “ProductKey” if guest OS must be activated during the first run and only “SkipAutoActivation” to postpone guest OS activation.
When deploying a new VPS WebsitePanel will mount VHD again and process this template with VPS-specific values.
When the sysprep process is finished “unattend.xml” file won’t be deleted automatically, however it might contain sensitive information (e.g. product key) that should be hidden from user. To delete “unattend.xml” create “SetupComplete.cmd” batch file in “\Windows\Setup\Scripts” folder (create this folder if not exists) and add the following file:
del /F /Q %windir%\system32\sysprep\unattend.xml
You can perform any other post-setup tasks in SetupComplete.cmd, for example change names of network connections:
cscript %windir%\Setup\Scripts\rename-connections.vbs del /F /Q %windir%\Setup\Scripts\rename-connections.vbs
You can get “rename-connections.vbs” and complete SetupComplete.cmd from “Sysprep Files Pack for Windows Server 2008” on our web site. Don’t forget to add rename-connections.vbs for pre-processing in index.xml (see below).
You can find more information about “SetupComplete.cmd” here:
http://technet.microsoft.com/en-us/library/cc766314.aspx
Unmount VHD using “vmutils” tool:
vmutils UnmountVHD –path “c:\VPS\Templates\Windows 2008 Standard x64.vhd”