I am creating a base VM as the start of what I hope to be a VM tree of all the machine configurations that I regularly use.
On this base machine I have a small system drive of 10GB and a larger data drive of 40GB. When I sysprep the VM it removes the additional hard drive. Well it still appears but Server Manager reports it as offline.
I have the following in my answer file
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName></ComputerName>
<RegisteredOrganization>XXXXXX</RegisteredOrganization>
<RegisteredOwner>XXXXXX</RegisteredOwner>
<ShowWindowsLive>false</ShowWindowsLive>
</component>
<component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" 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>
<component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IEHardenAdmin>false</IEHardenAdmin>
<IEHardenUser>false</IEHardenUser>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>0809:00000809</InputLocale>
<SystemLocale>en-GB</SystemLocale>
<UILanguage>en-GB</UILanguage>
<UserLocale>en-GB</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RegisteredOrganization>Company Name</RegisteredOrganization>
<RegisteredOwner>Company Name</RegisteredOwner>
<UserAccounts>
<AdministratorPassword>
<Value>cwBoAEAAcgBlAHAAbwAxAG4AdABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByAFAAYQBzAHMAdwBvAHIAZAA=</Value>
<PlainText>false</PlainText>
</AdministratorPassword>
</UserAccounts>
<AutoLogon>
<Password>
<Value>cwBoAEAAcgBlAHAAbwAxAG4AdABQAGEAcwBzAHcAbwByAGQA</Value>
<PlainText>false</PlainText>
</Password>
<Domain>WORKGROUP</Domain>
<Enabled>true</Enabled>
<LogonCount>2</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
</OOBE>
<Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1440</HorizontalResolution>
<VerticalResolution>900</VerticalResolution>
</Display>
<TimeZone>GMT Standard Time</TimeZone>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
</component>
<component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
</component>
</settings>
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<WillShowUI>OnError</WillShowUI>
<Disk wcm:action="add">
<ModifyPartitions>
<ModifyPartition wcm:action="modify">
<Active>true</Active>
<Letter>D</Letter>
<PartitionID>1</PartitionID>
<Label>Data</Label>
<Order>1</Order>
</ModifyPartition>
</ModifyPartitions>
<DiskID>1</DiskID>
<WillWipeDisk>false</WillWipeDisk>
</Disk>
</DiskConfiguration>
</component>
</settings>
<cpi:offlineImage cpi:source="catalog:c:/users/chalee/desktop/install_windows server 2008 r2 serverenterprise.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
I had assumed that the ModifyPartition section would set my second drive to online, but no dice!
Can anyone help with this? How should be answer file be configured to enable this second drive?
I solved this by writing a diskpart script.
The script was really simple:
I saved this as c:\windows\setup\scripts\partdisk.txt
I then created a cmd script like this:
This was added to the Setupcomplete.cmd file in c:\windows\setup\scripts (create it if it does not exist) this script is executed after the Windows installation has completed when the sysprepped machine is first booted up.
This solved the problem, but it will be the first of many problems on the road to a smooth tree of usable and useful VM images.
If I were you, I would create the installation on a VM without the 2nd disk, shut it down, and copy the .vmdk (the normal one; and the -flat one as well). Edit them (only has to be done on one, I can't recall which) in a text editor such as vi, and at the top (first 5 or so lines) you should find the name of the VM. Change this, as well as the name of the vmdk into the name of the new VM and then go and create a VM in your vSphere client.
When choosing what hard disk to use, simply choose existing harddisk, point to the file you just edited and renamed, and check "edit options before completion". Then add a new, empty HD of any size. Afterwards you can start it up and sysprep the VM and all should be fine.