MDT 2012 Update 1: Deploy to VHD


I was working on a separate blog posting (to be posted soon) that referenced the “Deploy to VHD” support that was present in MDT 2012 and improved in MDT 2012 Update 1 and wanted to include a link to that previous blog.  Except there was no previous blog – I guess I never did one…

So let’s start with what was added in MDT 2012.  Present in this version are two task sequence templates:

  • Deploy to VHD Client Task Sequence.  This is the equivalent of the “Standard Client Task Sequence” template, modified to deploy a client OS (Windows 7 or above) into a VHD file.
  • Deploy to VHD Server Task Sequence.  This is the equivalent of the “Standard Server Task Sequence” template, modified to deploy a server OS (Windows Server 2008 R2 or above) into a VHD file.

Just to be clear, these task sequences have nothing to do with the creation of virtual machines (although you could use them in virtual machines – there’s nothing preventing a VM from using boot from VHD).  Instead, these are designed to do the following, in the case of a new computer deployment:

  • Format and partition the physical disk.
  • Create a new, empty VHD file.
  • Format and partition the VHD file.
  • Apply the specified operating system WIM image to a volume created in the VHD file.
  • Set up a BCD entry to boot from the OS volume contained in the VHD file.

Of course all the other standard task sequence components are present too (injecting drivers, installing apps, applying patches, etc.).  Also, in MDT 2012 Update 1, the first step to format and partition the physical disk can be skipped, causing the new OS to be created on the existing disk, not disturbing the existing OS that might be on that disk.  As a result, you could then have a dual-boot computer, choosing the appropriate OS from the boot menu as there would be multiple BCD entries.

MDT 2012 Update 1 also will work with other scenarios, e.g. refreshes, but I’m not exactly sure why would want to do that.  Imagine what happens:  The user state is captured from current OS on the disk, a new VHD is created with the new OS, and then the user state is restored into that new OS in the VHD.  But now the user state is in both places, in the old OS and in the new OS.  (MDT 2012 RTW wouldn’t preserve the existing BCD, so you would always end up with only one BCD entry.  That behavior was fixed in MDT 2012 Update 1.)

If you want to try refreshing from a system already booting from a VHD file into a new OS running from a VHD file (same or different one), don’t.  It won’t work.  The challenge is that MDT really isn’t aware that the existing OS volume is in a VHD, so it might run into a variety of issues (e.g. staging the boot WIM in the VHD, or any operation that requires accessing the old OS files from within Windows PE).

So why is this referred to as “Deploy to VHD”?  It’s called that because MDT is not moving around VHD files (which would be highly inefficient, as these files aren’t compressed in any way).  Instead, it creates a new empty VHD file and deploys the operating system WIM file into it.  This is actually fairly fast and efficient, and surprisingly doesn’t complicate the deployment process very much at all.

Why might you want to do this?  This is primarily useful as a mechanism for setting up an additional OS on an existing computer.  Personally, I prefer using virtual machines for most things, but there could be some valid cases where using an OS running on the physical hardware (which after all is what you are doing, even when booting from a VHD file) is advantageous.

There are a few gotchas in the process though.  Because of some technical issues that could occur when using dynamically expanding VHDs, any time you perform a “boot from VHD” the VHD file will automatically expand to its full size (to make sure that Windows never needs to do this while the OS in the VHD is actively running).  So even if you have a 10GB operating system WIM (expanded from a 3GB WIM), you’ll end up with a much larger VHD file.  By default, MDT will create a VHD file whose maximum size is 80% of the available disk space on the OS volume.  So if you do a bare metal deployment to a computer with a 128GB physical drive, you’ll end up with a 102GB VHD file and about 26GB of free disk space.  You can customize this by editing the task sequence if you don’t want it to be that large:

image

Another gotcha has to do with the use of differencing disks, which you can see in the above screen shot.  What happens if you configure that?  Well, it will happily create a new empty VHD and then create a differencing disk on that empty VHD.  So then when the operating system image gets deployed, it ends up writing the whole thing into the differencing disk, while the parent VHD stays empty.  That’s not terribly useful.  But there are some additional properties in the underlying MDT ZTIVHDCreate.wsf script that could be leveraged instead to have MDT start by making a copy of an existing VHD file, instead of starting with an empty VHD.  But that’s a more advanced scenario, left for the creative types.

Comments (8)
  1. Thanks for ur post says:

    I would like to know, if you have the info where can I modify the VHD settings  for this tasks like Description, because when I boot I have 2 Win7 entries and I would liek to know where on MDT scripts or variables I could modify the VHD entry on bcdedit part. thanks

  2. adam says:

    Have you ever tried a full deployment of a duel boot machine. So that the task sequence would deploy the primary os to disk and then a secondaly os to VHD in one sequence?

  3. Michael Klinteberg says:

    Hi
    Here’s my scenario.
    Install Windows 7 SP1 64bit using standard Client.xml template.
    Install Windows 8.1 64bit using VHDClient.xml template.
    In the Windows 8.1 task sequence I disabled "Format and Partition Disk" step.

    Windows 8.1 installed fine but MDT removed previously BCD entries for Windows 7.

    Looking in the LTIApply.wsf and function I see the if statement.
    If ucase(oEnvironment.Item("IsUEFI")) = "TRUE" then


    oLogging.CreateEntry "Removing existing BCD so it can be recreated using BCDBOOT.", LogTypeInfo
    Else

    If oEnvironment.Item("VHDDisks") <> "" then
    oLogging.CreateEntry "Skip Removal of BCD files in VHD Scenarios.", LogTypeInfo

    So when IsUEFI = true then it always remove BCD entries.

    I added another If statement to the IsUEFI=True section. So that when VHDDisks have some data it won’t clear the BCD entries.

    Here’s the full If statement.

    If ucase(oEnvironment.Item("IsUEFI")) = "TRUE" then

    ‘ Remove old BCD, as it might get in the way
    On Error Resume Next
    If oEnvironment.Item("VHDDisks") <> "" then
    oLogging.CreateEntry "IsUEFI sectiom. Skip Removal of BCD files in VHD Scenarios.", LogTypeInfo
    Else
    ‘If oFSO.FileExists(Left(oBootDrive.Drive,2) & "efimicrosoftbootbcd") then
    oLogging.CreateEntry "Removing existing BCD so it can be recreated using BCDBOOT.", LogTypeInfo
    oFSO.DeleteFile Left(oBootDrive.Drive,2) & "efimicrosoftbootbcd", true
    End if

    ‘ When using Windows ADK, specify that we want to update the UEFI BCD (in firmware).
    ‘ When using Windows AIK, don’t specify a store as it *should* figure it out.

    If Left(oEnvironment.Item("OSCurrentVersion"), 3) >= "6.2" then
    TestAndFail RunBCDBootEx( sDestinationDrive & "windows", " /s " & left(oBootDrive.Drive,2) & " /f UEFI"), 5616, "Verify BCDBootEx"
    Else
    TestAndFail RunBCDBootEx( sDestinationDrive & "windows", " "), 5616,"Verify BCDBootEx"
    End if

    ‘ Make sure the boot menu timeout is 0

    RunBCDEdit "/timeout 0"

    Else

    ‘ Remove old BCD, as it might get in the way

    On Error Resume Next
    If oEnvironment.Item("VHDDisks") <> "" then
    oLogging.CreateEntry "Skip Removal of BCD files in VHD Scenarios.", LogTypeInfo
    ElseIf oFSO.FileExists(Left(oBootDrive.Drive,2) & "bootbcd") then
    oLogging.CreateEntry "Removing existing BCD so it can be recreated using BCDBOOT.", LogTypeInfo
    oFSO.DeleteFile Left(oBootDrive.Drive,2) & "bootbcd", true
    End if
    On Error Goto 0

    ‘ Create a new boot entry

    TestAndFail RunBCDBootEx( sDestinationDrive & "windows", " /s " & left(oBootDrive.Drive,2)),5616,"Verify BCDBootEx"

    ‘ Make sure the boot menu timeout is 0

    RunBCDEditEx "/timeout 0", Left(oBootDrive.Drive,2) & "bootbcd", null

    End if

  4. Michael Klinteberg says:

    Sorry. I missed one important word in the previous post.
    The line "Looking in the LTIApply.wsf and function I see the if statement." should read like this "Looking in the LTIApply.wsf and function ApplyImage I see the if statement."

  5. showbox says:

    Thanks for the great info. I really loved this. I would like to apprentice at the same time as you amend your web site, how could i subscribe for a blog site?
    For more info on showbox please refer below sites:
    http://showboxandroids.com/showbox-apk/
    http://showboxappandroid.com/
    Latest version of Showbox App download for all android smart phones and tablets.
    http://movieboxappdownloads.com/ – It’s just 2 MB file you can easily get it on your android device without much trouble. Showbox app was well designed application for android to watch movies and TV shows, Cartoons and many more such things on your smartphone.
    For showbox on iOS (iPhone/iPad), please read below articles:
    http://showboxappk.com/showbox-for-ipad-download/
    http://showboxappk.com/showbox-for-iphone/
    Showbox for PC articles:
    http://showboxandroids.com/showbox-for-pc/
    http://showboxappandroid.com/showbox-for-pc-download/
    http://showboxforpcs.com/
    There are countless for PC clients as it is essentially easy to understand, simple to introduce, gives continuous administration, effectively reasonable. it is accessible at completely free of expense i.e., there will be no establishment charges and after establishment
    it doesn’t charge cash for watching films and recordings. Not simply watching, it likewise offers alternative to download recordings and motion pictures. The accompanying are the strides that are to be taken after to introduce Showbox application on Android.
    The above all else thing to be done is, go to the Security Settings on your Android telephone, Scroll down and tap on ‘Obscure sources’.

  6. Haruna says:

    Useful Thank You Sayings in general, for providing the requested information.
    http://goo.gl/w7evPl

  7. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teknik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teknisi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Televisi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teller
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20TNI
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Trans7
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20PLN
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Telkomsel
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Kimia%20Farma
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Pusat
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Jakarta%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Utara
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Indosat
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20XL%20AXIATA
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bangka%20Belitung
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Gorontalo
    http://www.lokerjobindo.com/search/label/Loker%20Daera%20Jambi
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Tengah
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Tengah
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Utara
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Sopir
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Statistik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20swasta
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Tambang

  8. aw says:

    hai, I just want to tell you that I am just very new to blogs and seriously loved this website. More than likely I’m planning to bookmark your blog post .
    You amazingly come with really good posts. Thanks a lot for sharing your blog Microsoft.

    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teknik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teknisi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Televisi
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Teller
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20TNI
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Trans7
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20PLN
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Telkomsel
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Kimia%20Farma
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Pusat
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Jakarta%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jakarta%20Utara
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Indosat
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20XL%20AXIATA
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Bangka%20Belitung
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Gorontalo
    http://www.lokerjobindo.com/search/label/Loker%20Daera%20Jambi
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Tengah
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Jawa%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Barat
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Selatan
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Tengah
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Timur
    http://www.lokerjobindo.com/search/label/Loker%20Daerah%20Kalimantan%20Utara
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Sopir
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Statistik
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20swasta
    http://www.lokerjobindo.com/search/label/Lowongan%20Kerja%20Tambang

Comments are closed.