3

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?

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
Charlie
  • 181
  • 2
  • 10

2 Answers2

3

I solved this by writing a diskpart script.

The script was really simple:

select disk 1
online disk

I saved this as c:\windows\setup\scripts\partdisk.txt

I then created a cmd script like this:

partdisk /s c:\windows\setup\scripts\partdisk.txt

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.

Charlie
  • 181
  • 2
  • 10
0

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.

HannesFostie
  • 845
  • 14
  • 29
  • I don't understand this. I have a working VM with both hard disks configured correctly, but when I sysprep it and try to start up a clone of this sysprepped image the second drive is always offline. If I used your method I suspect I would still end up with my second drive offline as it is the sysprepping and my answer file that appears to be causing the issue. – Charlie Jun 23 '10 at 11:55
  • I realize it's not really a solution, it's more of a workaround. If you were to clone your VM my way, ie edit and rename the files, boot it, sysprep it, then the VM will work. After that, you can add any number of harddisks you want. It's as if you would create an image of a pc with only 1 disk, clone it, then add a new disk. When cloning the VM your way, did you check if the vmdk file of the 2nd harddisk contained the name of the old VM? – HannesFostie Jun 23 '10 at 12:55
  • Come to think of something. Why are you sysprepping? Is it just to change the SID? Because that shouldn't matter anymore as per http://en.wikipedia.org/wiki/Security_Identifier#Duplicated_SIDs As long as the VM in question isn't part of a domain, a temporary duplicate hostname shouldn't be too big of a deal either, I think. – HannesFostie Jun 23 '10 at 13:11
  • I am sysprepping because this VM will potentially be used by many developers on the same domain and they need different license keys, server names etc. What I want is to be able to sysprep my VM and retain the hard drive configuration. Is this not possible? – Charlie Jun 24 '10 at 09:30
  • I'm not sure, I have no real experience with this scenario. I'm afraid I won't be of much help other than the workaround I provided. I know that when you clone a Win7 like we do with Acronis, it will ask you to change the product key, perhaps there's a general function to change it as well for XP or whatever it is you decide to use. That way you don't have to sysprep I guess. – HannesFostie Jun 24 '10 at 12:28