1

I'm attempting to set up multiple drive letters (whole disk partitions) on a second and third disk during the autounattend.xml install of Server 2012.

The partitions are created and formatted. However, the drives (disks 1 & 2) are marked as 'offline' when I login for the first time. If I manually mark them as online through Disk Management they are assigned the right drive letter and all is well.

I've tried to add a simple diskpart script to SetupComplete.cmd without luck. Here's my SetupComplete.cmd file that doesnt work:

mkdir c:\temp
echo select disk 1 >> c:\temp\dp.txt
echo online disk >> c:\temp\dp.txt
echo select disk 2 >> c:\temp\dp.txt
echo online disk >> c:\temp\dp.txt
diskpart /s c:\temp\dp.txt

However, this file does work if I run it when I first login! Is there a way to set other partitions either using autounattend.xml or using a script?

Here's the pertinent section from the autounattend.xml:

<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">
                <CreatePartitions>
                    <CreatePartition wcm:action="add">
                        <Order>1</Order>
                        <Size>350</Size>
                        <Type>Primary</Type>
                    </CreatePartition>
                    <CreatePartition wcm:action="add">
                        <Order>2</Order>
                        <Extend>true</Extend>
                        <Type>Primary</Type>
                    </CreatePartition>
                </CreatePartitions>
                <ModifyPartitions>
                    <ModifyPartition wcm:action="add">
                        <Active>true</Active>
                        <Label>Boot</Label>
                        <Format>NTFS</Format>
                        <Order>1</Order>
                        <PartitionID>1</PartitionID>
                    </ModifyPartition>
                    <ModifyPartition wcm:action="add">
                        <Format>NTFS</Format>
                        <Order>2</Order>
                        <PartitionID>2</PartitionID>
                        <Label>System</Label>
                    </ModifyPartition>
                </ModifyPartitions>
                <DiskID>0</DiskID>
                <WillWipeDisk>true</WillWipeDisk>
            </Disk>
            <Disk wcm:action="add">
                <CreatePartitions>
                    <CreatePartition wcm:action="add">
                        <Order>1</Order>
                        <Type>Primary</Type>
                        <Extend>true</Extend>
                    </CreatePartition>
                </CreatePartitions>
                <ModifyPartitions>
                    <ModifyPartition wcm:action="add">
                        <Format>NTFS</Format>
                        <Label>WorkSpace</Label>
                        <Letter>Y</Letter>
                        <Order>1</Order>
                        <PartitionID>1</PartitionID>
                        <Active>true</Active>
                    </ModifyPartition>
                </ModifyPartitions>
                <DiskID>1</DiskID>
                <WillWipeDisk>true</WillWipeDisk>
            </Disk>
            <Disk wcm:action="add">
                <CreatePartitions>
                    <CreatePartition wcm:action="add">
                        <Order>1</Order>
                        <Type>Primary</Type>
                        <Extend>true</Extend>
                    </CreatePartition>
                </CreatePartitions>
                <ModifyPartitions>
                    <ModifyPartition wcm:action="add">
                        <Format>NTFS</Format>
                        <Label>TempDB</Label>
                        <Letter>T</Letter>
                        <Order>1</Order>
                        <PartitionID>1</PartitionID>
                        <Active>true</Active>
                    </ModifyPartition>
                </ModifyPartitions>
                <DiskID>2</DiskID>
                <WillWipeDisk>true</WillWipeDisk>
            </Disk>
        </DiskConfiguration>
        <ImageInstall>
            <OSImage>
                <InstallTo>
                    <PartitionID>2</PartitionID>
                    <DiskID>0</DiskID>
                </InstallTo>
                <InstallToAvailablePartition>false</InstallToAvailablePartition>
                <WillShowUI>OnError</WillShowUI>
                <InstallFrom>
                    <MetaData wcm:action="add">
                        <Key>/IMAGE/NAME</Key>
                        <Value>Windows Server 2012 SERVERSTANDARD</Value>
                    </MetaData>
                </InstallFrom>
            </OSImage>
        </ImageInstall>
        <UserData>
            <ProductKey>
                <Key>48HP8-DN98B-MYWDG-T2DCC-8W83P</Key>
                <WillShowUI>OnError</WillShowUI>
            </ProductKey>
            <AcceptEula>true</AcceptEula>
            <FullName>--</FullName>
            <Organization>--</Organization>
        </UserData>
        <UseConfigurationSet>true</UseConfigurationSet>
    </component>
natefox
  • 33
  • 1
  • 5

2 Answers2

2

This could be because the San policy is set to ‘OfflineShared’ by default for some SKUs of Windows server. This is the default setting because if the disks are shared between servers (unless part of a cluster), data corruption can occur if the setting is changed to ‘OnlineAll’.

This Microsoft Support article explains the issue and has this example unattend snippet to show you how to do this:

<component name="Microsoft-Windows-PartitionManager" 
publicKeyToken="31bf3856ad364e35" 
language="neutral" 
versionScope="nonSxS" 
processorArchitecture="x86"> 
<SanPolicy>1</SanPolicy> 
</component>

There is also a warning to reset this policy back to ‘OfflineShared’ after the installation to avoid the data corruption issues that can occur.

While this document is specifically for Windows Server 2008/2008R2, this still relates to Windows Server 2012 as seen in this TechNet article.

Also, in the autounattend.xml section that you posted, you are marking partitions active on those other disks. Unless you are going to boot to other OS’s on those disks, you should avoid marking those partitions as active.

More information on using answer files to deploy Windows can be found at the Springboard Series pages on TechNet.

Hope this helps

dwolters
  • 1,255
  • 7
  • 11
  • This worked perfectly for local disks. I saw the setting but assumed it was for SAN disks. Thanks! – natefox Jan 28 '13 at 22:53
0

The solution suggested didn't work for me :( I have gone with an command in the FirstLogonCommands section

                                <SynchronousCommand wcm:action="add">
                                    <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Get-Disk | Where-Object Number -Eq 1 | Set-Disk -IsOffline $False"</CommandLine>
                                    <Description>Sets online the D: drive</Description>
                                    <Order>24</Order>
                                    <RequiresUserInput>false</RequiresUserInput>
                            </SynchronousCommand>