none
Windows Server 2008 R2 drive letter changes after Sysprep RRS feed

  • Question

  • Hello Colleagues,

    I am building with SysPrep an Image for Windows Server 2008 R2 (on a HP DL380 G5 server). The R2 is located on drive D: (on drive C: there is a Windows Server 2003 located) and this drive letter assignment should be preserved.
    Drive C: is the first partition on Disk 0 (primary, active), Drive D: is a logical drive in an extended partition.
    Unfortunately, the drive letter changes to C: after starting the syspreped R2 OS (and the partition which was former drive C: is then drive D:).

    I executed sysprep as follows: sysprep /oobe /generalize /unattend:<Drive>:\unattend.xml /shutdown
    I have created the unattend.xml with the SIM tool (from the WAIK) and even choosing the option Microsoft-Windows-PnpSysprep | PersistAllDeviceInstalls isn't successful.
    Assingment of a drive letter via unattend.xml isn't possible, because these steps are only available for WindowsPE phase, and not for generalize or specialize phases, which are running after using the /generalize switch of sysprep.

    We have build syspreped images of Windows Server 2008 and had no problems at all with the drive letter assignment.

    Any idea how to keep the drive letter for a syspreped R2 would be appreciated.

    Kind Regards,
     Frank
    Friday, November 20, 2009 4:14 PM

Answers

  • Hi all,

    I want to complete this thread and I have a workaround for this drive letter issue. I contacted (end of last year) the MS Support and after confirming the behaviour with the drive letter change they told me that this is by design. Hm... But they gave me a workaround which is as follows:

    1. extract the MountedDevices information from the active Operating system on drive C: (i.e. export via regedit the HKLM\SYSTEM\MountedDevices)
    2. load the SYSTEM registry hive of the "syspreped" Win2008 R2 from drive D:
    3. import the MountedDevices subkey into the SYSTEM hive of the Win2008 R2
    4. boot the Win2008 R2

    Usually it is sufficient to import only the value "\DosDevices\D:" and to ingore the other values in subkey "MountedDevices", the other information will be created by the drive detection of Win2008 R2.

    This works flawless, I have already integrated this in our automatic infrastructure and observed no problems until now.

    The issue with the changed BCDStore entries isn't solved with this but it is not critical in my eyes (first it's easy to correct the Boot entries, second it only occurs on the host where you execute sysprep).

    Hope this helps all interested readers.

    Kind Regards,
    Frank

    • Marked as answer by Franky_H Thursday, March 4, 2010 9:22 AM
    Thursday, March 4, 2010 9:21 AM

All replies

  • Hi,

    This seems like a strange problem - when you boot to Windows 2003 is %systemdrive% C or D? Have you tried setting the WinPE disk configuration settings in the unattend file? If you do a sysprep when the controller reboots it goes through each of the passes (this includes the WinPE pass). So something like the below unattend code might work:

                <DiskConfiguration>
                    <Disk wcm:action="add">
                        <ModifyPartitions>
                            <ModifyPartition wcm:action="add">
                                <Label>Win2k3</Label>
                                <Letter>C</Letter>
                                <Order>1</Order>
                                <PartitionID>1</PartitionID>
                            </ModifyPartition>
                            <ModifyPartition wcm:action="add">
                                <Active>true</Active>
                                <Label>Win2k8</Label>
                                <Letter>D</Letter>
                                <Order>2</Order>
                                <PartitionID>2</PartitionID>
                            </ModifyPartition>
                        </ModifyPartitions>
                        <DiskID>0</DiskID>
                        <WillWipeDisk>false</WillWipeDisk>
                    </Disk>
                </DiskConfiguration>
    Otherwise you could just do it manually with a setup diskpart script.

    Regards.
    • Marked as answer by Tim QuanModerator Thursday, November 26, 2009 1:42 AM
    • Unmarked as answer by Franky_H Friday, November 27, 2009 3:41 PM
    Monday, November 23, 2009 2:17 AM
  • Hi simo_415,

    thanks for your answer. Sorry for my delayed reply, I was very busy.
    Still I am sceptical about the WinPE pass with the ModifiyPartitions step. The thing is, we have already a disk layout and want to keep it as it is. With Windows Server 2008 we had no such problems. I explain the situation in more detail:

    Disk Layout:
    First partition on Disk0 is primary, system, active. There is a Windows Server 2003 x64 operating system located on it (drive letter C:).
    The second partition on Disk0 is an extended partition containing two logical partitions. On the first logical partition is the Windows Server 2008 R2 x64 operating system located (drive letter D:). The second logical partition is a Tools and Data partition (drive letter E:).
    There is also a Disk1 with an extended partition containing one logical partition and drive letter F:, but this doesn’t affect the behavior and is just mentioned for completeness.

    To summarize, we have a dual boot environment with an Win2003 on drive C: and a Win2008 R2 on drive D: and two drives for data (E: and F:).

    What happens:
    The SysPrep in Win2008 R2 is executed with the following command line:
    sysprep /oobe /generalize /unattend:D:\unattend.xml /shutdown

    I.e. we generalize the Win2008 R2 on drive D: for later deployment on identical servers with identical disk layout. To simulate this, we can just try to start the same generalized Win2008 R2 on the same server we have created it.
    Doing so, we observe the following symptoms:

    1. starting directly to the generalized Win2008 R2 the boot process stops with an error 0xc000000f (device not accessible). Examination of the BCDStore shows that the Boot entry for the Win2008 R2 was modified by SysPrep in a way that the attribute “device” has the value “locate=\Windows\system32\winload.exe” and the attribute “osdevice” has the value “locate=\Windows”.
    2. After changing the values of the device and osdevice attributes to “partition=D:” (alternatively we restored a BCDStore which was backuped before running SysPrep) we can boot the generalized Win2008 R2.
    3. After logging in to the Win2008 R2 we see that the OS drive has the drive letter “C:” instead of “D:”. The disk layout and the location of the OS hasn’t changed meanwhile.

    We used a similar mechanism for Windows Server 2008 and had no problems of this kind (neither the problem with the wrong BCDStore entries nor the problem with the drive letter assignment).

    Thanks and best Regards,
     Frank

    Friday, November 27, 2009 4:03 PM
  • Hi all,

    I want to complete this thread and I have a workaround for this drive letter issue. I contacted (end of last year) the MS Support and after confirming the behaviour with the drive letter change they told me that this is by design. Hm... But they gave me a workaround which is as follows:

    1. extract the MountedDevices information from the active Operating system on drive C: (i.e. export via regedit the HKLM\SYSTEM\MountedDevices)
    2. load the SYSTEM registry hive of the "syspreped" Win2008 R2 from drive D:
    3. import the MountedDevices subkey into the SYSTEM hive of the Win2008 R2
    4. boot the Win2008 R2

    Usually it is sufficient to import only the value "\DosDevices\D:" and to ingore the other values in subkey "MountedDevices", the other information will be created by the drive detection of Win2008 R2.

    This works flawless, I have already integrated this in our automatic infrastructure and observed no problems until now.

    The issue with the changed BCDStore entries isn't solved with this but it is not critical in my eyes (first it's easy to correct the Boot entries, second it only occurs on the host where you execute sysprep).

    Hope this helps all interested readers.

    Kind Regards,
    Frank

    • Marked as answer by Franky_H Thursday, March 4, 2010 9:22 AM
    Thursday, March 4, 2010 9:21 AM