Microsoft Windows 7 Config 70-680

Imaging Part 4: Configuring a VHD

by James Conrad

Start your 7-day free trial today.

This video is only available to subscribers.

A free trial includes:

  • Unlimited 24/7 access to our entire IT training video library.
  • Ability to train on the go with our mobile website and iOS/Android apps.
  • Note-taking, bookmarking, speed control, and closed captioning features.

Course Introduction

Installation Part 1: Clean Install

Installation Part 2: Upgrade and Migration

Imaging Part 1: Creating a Reference Image

Imaging Part 2: Capturing and Deploying a Reference Image

Imaging Part 3: Preparing System Images

Imaging Part 4: Configuring a VHD

00:00:00 - Imaging Part 4. In this Imaging Part 4, which is our final discussion
00:00:05 - of imaging, we talk about the virtual hard disk and we talk about
00:00:08 - some of the advantages of working with it. By the way, you're
00:00:11 - not going to be using VHDs in all instances. It's not the latest
00:00:14 - fad and you have to use it, but certainly, it does have some
00:00:17 - advantages you will want to take a look at. We'll talk about
00:00:20 - how to create a VHD. It's primarily going to be using a tool
00:00:23 - called diskpart, although you can also use the Disk Management
00:00:26 - console. We'll take a look here as well at the VHD and doing
00:00:30 - a clean install to a VHD, and then having a native boot to a
00:00:34 - VHD image. We'll talk about deploying an existing WIM file to
00:00:39 - a VHD. This could be just a conventional install of WIM or it
00:00:42 - could be a reference one that you may have created earlier. We'll
00:00:45 - also talk about how to update and service a VHD and
00:00:49 - what you can do with those primarily is to use some tools using
00:00:52 - System Central Virtual Machine Manager, and you can also use
00:00:55 - just the ability to attach a VHD and mount it and then be able
00:00:59 - to browse through the file system and make modifications as necessary.
00:01:04 - I went to college at a small private college in the Midwest,
00:01:07 - and I recall that me and all the other students there were just
00:01:10 - dirt poor. I don't know how it is in other larger colleges. Maybe
00:01:13 - there are some rich kids there that their first day of their
00:01:16 - freshman classes, they show up driving a Ferrari or something
00:01:18 - like that. But we all drove things like Ford Pintos and Festivas,
00:01:23 - Ford Festivas. I don't know if you remember that. It's a really
00:01:24 - old car. And what was the other one? A Yugo. A friend of mine
00:01:28 - had a Yugo and Tercel and cars like that. Well, I remember
00:01:32 - that one Christmas break, I had gone home to visit my folks,
00:01:35 - and my Dad noticed that all the tires on my car were bald. So
00:01:40 - he graciously bought me brand new set of tires. When I showed
00:01:44 - back up at school, everybody seemed to notice that I had this
00:01:47 - brand new set of tires on my car. And it turned out that they
00:01:51 - started a rumor that I was actually from a very wealthy family
00:01:54 - and I was actually very wealthy myself, and I was just kind of
00:01:56 - covering it up by driving this old Ford wrecked car that I always
00:02:00 - used to drive around. It was a Ford Pinto.
00:02:03 - Well, for a while there, it was actually kind of fun. I mean
00:02:06 - everybody thought I was rich and I started getting attention
00:02:09 - from the girls for a change and they started to call me "that
00:02:10 - rich guy," which was a whole lot better than "that creepy guy,"
00:02:13 - so everything seemed to be pretty good for a while. But then
00:02:16 - when people expected me to always pay for pizza when we go out
00:02:18 - for pizza and stuff like that, I finally had to break those rumors
00:02:22 - down and let everybody know that my Dad just bought me a new
00:02:24 - set of tires and that was pretty much it. We weren't rich. I
00:02:29 - don't think I've gotten a girl to talk to me ever since then,
00:02:32 - except for my wife, and somehow or another, I conned her into
00:02:34 - marrying me, so I consider myself to be very fortunate there.
00:02:37 - But you see, that was a matter of image management. And certainly,
00:02:41 - with Windows, we have different kinds of images that we can work
00:02:44 - with as well. We've already talked about WIM files, but in particular,
00:02:47 - for this Nugget, we're going to be talking about something different.
00:02:50 - It's called a VHD file, and it's used not only for Windows operating
00:02:55 - systems in booting to a physical machine, but it's also used
00:02:58 - for booting to virtual machines. And in fact, that's primarily
00:03:01 - how we think of them. However, with Windows 7, and this is
00:03:05 - also true of Windows Server 2008 R2, you can now boot to a VHD
00:03:10 - file as if it were a physical hard drive. So before we get into
00:03:15 - something more about the virtual hard disk advantages in Windows
00:03:18 - 7, I want to identify first of all what they're normally used
00:03:21 - for in a conventional sense, and that would be for using something
00:03:25 - like Virtual PC or Hyper-V. Virtual PC and Hyper-V are the desktop
00:03:30 - and server versions respectively of using virtualization. For
00:03:34 - example, here is the console for my Hyper-V manager that appears
00:03:38 - over on my Windows Server 2008 R2 server. And you can see here
00:03:41 - that I've got a few virtual machines right there. None of them
00:03:44 - are started up right now, but I could start these up and pretty
00:03:47 - much run these as if they were on physical hardware for the most
00:03:50 - part. Now, if I take a look at what's behind the scenes there,
00:03:54 - here are the actual files that are involved in those virtual
00:03:57 - machines. So for example, for Windows Server 2008 R2 that we
00:04:01 - saw over there, and let me bring this back over, you see this
00:04:04 - operating system right here. Well, that's actually this VHD file.
00:04:10 - And then here, you have certain snapshots, of you want to call
00:04:13 - them that, point in time snapshots of differences. These are
00:04:16 - differencing disks. So anyway, this VHD file here is what is
00:04:22 - used to boot and run that operating system in a virtualized environment.
00:04:27 - A very similar if you are accustomed to working with VMware,
00:04:32 - very similar to a VMDK file, which is what they use in that product.
00:04:36 - But as it relates to Microsoft products, we use VHDs for virtual
00:04:40 - machines. Now, they are useful for virtual machines, but they
00:04:43 - are also useful now for physical machines starting with Windows
00:04:47 - 7 and Windows Server 2008 R2. Some of the advantages there might
00:04:51 - be things such as these: if you run a VHD and boot to it, then
00:04:56 - you see the entire desktop the same as if you would on a physical
00:05:00 - machine. It would be exactly the same as if there is a single
00:05:03 - physical hard drive with thousands of different Windows files
00:05:06 - scattered all over the place. Well, instead, you're actually
00:05:09 - using a single file, just a VHD file. But it's also able to take
00:05:14 - advantage of all the physical characteristics of that machine.
00:05:17 - So for example, if you have devices that you need to use, it
00:05:20 - will fully detect those devices just the same as if it were a
00:05:24 - normal installation of Windows. Also, for software issues,
00:05:28 - for example, maybe you have a scenario where you're testing out
00:05:32 - software and you're not quite sure if it's maybe compatible with
00:05:35 - Windows 7 or something like that. Well, you could put the whole
00:05:38 - thing in a virtual machine if you want on Windows 7, or you could
00:05:41 - still use it on a physical machine if you wanted to go through
00:05:45 - various generations of something like a thick image. And if you
00:05:48 - find out that various iterations of that software work just fine,
00:05:53 - then you can package it up into a VHD and then deploy that VHD
00:05:56 - to various clients, including the software that you might want
00:06:00 - it to include. On the other hand, if in your testing you find
00:06:03 - out that the latest revision of that software causes the system
00:06:06 - to crash, well, then you can delete the VHD file and replace
00:06:10 - it with a previous one that you know worked. So one of the
00:06:14 - key advantages there, and there are several different ones; these
00:06:16 - are just some of the ones, there is also a uniform file format.
00:06:20 - This is something that is not going to be different per vendor
00:06:24 - or something like that. VHD files are very familiar with a lot
00:06:27 - of Microsoft products and server operating systems, such as System
00:06:32 - Center Virtual Machine Manager. Other Microsoft products work
00:06:35 - very well with this uniform file format, so you don't have to
00:06:38 - be concerned about conversion between different file formats
00:06:42 - and things like that. VHD is a VHD. Also, we have common tools,
00:06:46 - tools that you can use to administer Windows VHD files that you
00:06:51 - would normally use in Hyper-V or in Virtual PC. You can use those
00:06:55 - same tools usually with VHD files that you might use to boot
00:06:58 - from in a physical machine. And by the way, when we talk about
00:07:02 - a physical machine, then you're going to have let me just draw
00:07:05 - something out here you're going to have a physical hard drive
00:07:08 - like this, and then on that, you'll have a VHD file. It's only
00:07:12 - a single file. And when you boot from this, in the visuals
00:07:18 - of this, for example, if you were to open up Windows Explorer
00:07:21 - after your logged on, you would see all of the Windows files
00:07:24 - and folders and sub-folders and so forth just the same as if
00:07:27 - it were a physical machine. But behind the scenes there, it's
00:07:31 - actually only a single file. It's just that when you boot it,
00:07:34 - it exposes the contents of that VHD file into the file and folder
00:07:38 - substructure. But what I'm trying to get to there is this is
00:07:41 - called a native boot, so it's a native boot to a VHD, same as
00:07:47 - it's just a physical boot to a VHD. This is also going to be
00:07:51 - useful for a single file restore. Let's say that we have a known
00:07:55 - good copy of the VHD. Maybe we're using it for our imaging solution,
00:07:58 - for example. And we have a customer whose VHD got corrupt or
00:08:02 - went bad or something like that. Well, all we have to do is to
00:08:05 - copy a known good VHD back to this computer, and they are back
00:08:08 - in business. And that's assuming of course that other things
00:08:11 - are in play, such as roaming user profiles or that their home
00:08:14 - directory is redirected to a file server somewhere and things
00:08:17 - of this nature. Also, the performance for a native VHD boot
00:08:23 - compared to virtual machines is pretty good because with virtual
00:08:28 - machines, you do have a lot of advantages. You can take snapshots
00:08:31 - and differencing disks and so forth. However, there is still
00:08:35 - a hypervisor level there. There is kind of an intermediate software,
00:08:38 - and this is true of all virtualization products. There is an
00:08:41 - intermediate software that will slow down the system somewhat
00:08:44 - because everything has to be translated back and forth between
00:08:47 - the software. So the performance is normally going to be better
00:08:51 - on a VHD and a native VHD as opposed to using a virtual machine.
00:08:56 - The first thing you're going to do if you want to work with
00:08:58 - VHD is you have to create a VHD. Now how would you do that if
00:09:02 - you were within the Windows 7 operating system? And also, what
00:09:05 - would the purpose be? First of all, the purpose would be a couple
00:09:09 - of ideas. There might be multiple reasons why it would do this,
00:09:12 - but here are just a couple that come to mind. One, you might
00:09:13 - want to set up a dual boot. Maybe sometimes you have to work
00:09:16 - with Windows 7 and you need to be able to identify physical hardware
00:09:20 - as opposed to virtualized hardware. And other times, you need
00:09:22 - to boot to Windows Server 2008. Well, normally, you would have
00:09:26 - to have two separate partitions in order to do that. We talked
00:09:28 - about that early in our series here. Normally, you'd have to
00:09:31 - have two physically separate partitions. But with a VHD, you
00:09:35 - could still retain a single partition and then just put a VHD
00:09:38 - file on that partition, and that would be your other operating
00:09:42 - system and it would be contained within that VHD file. So it's
00:09:45 - very clean and you don't have to worry about the two operating
00:09:48 - systems getting their files mixed together and all that sort
00:09:51 - of thing. Also, it might be very useful for preparing a reference
00:09:55 - image. Some organizations may prefer instead of working strictly
00:09:57 - with WIM files is to work with a combination of WIM files and
00:10:01 - VHDs. And that way, you can take your VHD and you can boot it
00:10:05 - up to physical hardware and a native boot like we're talking
00:10:08 - about earlier, or if you're trying to test it out and you see
00:10:12 - maybe some of your customers are having problems with that VHD
00:10:15 - file, then you can take that same VHD and boot it up using Hyper-V
00:10:19 - or Virtual PC or some other method there to be able to use virtualization,
00:10:24 - and you can test it out on a smaller scale without having to
00:10:27 - duplicate that exact same physical hardware. There is a couple
00:10:31 - of methods for creating VHDs. One of the methods there would
00:10:34 - be to use the Disk Management console, which I'm going to show
00:10:36 - you here shortly, and also Diskpart, which I'll show you a little
00:10:39 - bit later on, and that's going to be primarily how we're going
00:10:42 - to be working with VHDs for some of the other purposes that I'll
00:10:45 - tell you about. All right then, here we go. We've got computer
00:10:49 - management open, and don't be too concerned about all the various
00:10:51 - partitions of things you see here. I've got just a lot going
00:10:54 - on on this particular computer. But let's say that I wanted a
00:10:58 - VHD here on my Images folder. And if I explore this and drag
00:11:02 - a window over here, you'll see that in the Images folder, there
00:11:05 - is a VHD folder, and I've already got something that I've been
00:11:08 - working with there, which I'll show you a little bit later on.
00:11:10 - But I want to create an additional VHD in that folder. How would
00:11:13 - I go about doing that? What we would do here is we would go
00:11:16 - over to Disk Management, and this is new with Windows Server
00:11:19 - 2008 R2 and Windows 7. You'd right click and you can see it right
00:11:23 - there, Create VHD. So I'll create this and I'll browse for the
00:11:28 - location of the VHD file that I'm about to create. I'm just going
00:11:31 - to call this one "test" because I'm not going to really use this
00:11:34 - for anything else other than showing you. And then I could specify
00:11:37 - the size of this. I'm going to make it small as well because
00:11:39 - I don't really need anything right now. I'll show you a larger
00:11:41 - one when we actually do a native boot, for example.
00:11:45 - Then I also have to identify whether I want it to be dynamically
00:11:48 - expanding or a fixed size. If I choose 20 megabytes and I only
00:11:52 - need 10 megabytes worth of storage space, then it will keep it
00:11:55 - at that size, but if it needs to get bigger, then it will do
00:11:58 - so as necessary.
00:12:00 - The problem with that though is that it's also going to provide
00:12:04 - a performance penalty, so you have to be aware of that. Microsoft
00:12:08 - does not recommend dynamically expanding virtual disks for native
00:12:13 - boot environments. It's more useful for test environments or
00:12:17 - for real virtualization and things of this nature. But for a
00:12:21 - native boot especially, they do not recommend dynamically expanding
00:12:23 - for performance purposes. You can also use a fixed disk size,
00:12:27 - and that would be the recommended solution especially for situations
00:12:31 - in which you have a native boot. And it's just going to stay
00:12:35 - at whatever size you specify here and it's not going to fluctuate.
00:12:38 - So I'm going to go ahead and leave it fixed for the time being
00:12:41 - and that will be fine. And then once this takes place, you'll
00:12:43 - notice something happen. I don't know if you can hear that, but
00:12:46 - the was the "bloop" sound that Windows 7 makes when Plug and
00:12:50 - Play takes place. You see Plug and Play has determined that,
00:12:53 - detected another disk that was installed right now. So what
00:12:57 - I would have to do in order to further use this within the Windows
00:13:00 - UI is to right click on it and choose initialize disk, and I
00:13:05 - have to choose master boot record or GPT. Most of the time, we're
00:13:08 - going to be using a master boot record. And then once that's
00:13:11 - been done, this is now available to format and partition and
00:13:15 - otherwise manipulate it as I like. This is also now an attached
00:13:20 - virtual disk. If I want to get rid of it, I don't really need
00:13:22 - it anymore or something like that, then I can right click on
00:13:25 - this and I can choose detach VHD. And when I do that, it also
00:13:29 - gives me the opportunity to delete the virtual hard disk after
00:13:33 - I've removed it and I can click OK now.
00:13:36 - And then for clarity's sake, again, one of the reasons why
00:13:38 - I might even create this VHD in the first place, like I just
00:13:41 - showed you the one I created, would be again to set up something
00:13:44 - like a dual boot scenario. So I might create a big VHD there
00:13:49 - and then I could install Windows Server 2008 into that VHD. Then
00:13:55 - I could dual boot between Windows 7 and Windows Server 2008 R2.
00:14:00 - Now, let's also take a look here at how we can work with VHD
00:14:03 - in a clean install. This is kind of a 30,000-foot view. This
00:14:07 - does not have all the steps, but I'm going to show them to you
00:14:09 - here in a moment. If I wanted to do a clean install to a virtual
00:14:13 - hard disk, maybe it's on a clean hard drive, well, I would use
00:14:17 - a couple of tools to do this. One of the tools I would use would
00:14:20 - be WinPE. And I'm just going to use the WinPE that we created
00:14:23 - a few Nuggets ago when we first started talking about imaging.
00:14:26 - And my purpose in doing that is so that I can use some of the
00:14:28 - tools, including ImageX and Diskpart. Once I've booted up WinPE,
00:14:33 - I want to press Shift+F10,
00:14:35 - or alternatively, you could choose a repair of Windows, and that
00:14:39 - will provide a command prompt option for you. But my whole point
00:14:42 - there is with Shift+F10 is I get a command prompt, which I can
00:14:45 - then use to start typing in these commands. And the first one
00:14:48 - I'm going to be really working with is Diskpart. When I work
00:14:52 - with Diskpart, I'll be creating one or more partitions and there
00:14:56 - has to be a partition there and it has to be formatted so that
00:14:59 - I can then create a VHD. The VHD is a file and so it has to exist
00:15:05 - in a file system. So that's why I have to have a partition so
00:15:08 - that it has some place to live. Once I have created that VHD,
00:15:11 - then I can perform the installation into that VHD. And of course,
00:15:16 - using Diskpart, I'll also have to attach it. And once you attach
00:15:19 - it, then it appears visible and you can work with it as if it
00:15:22 - were a physical hard drive. Let's go ahead and take a look at
00:15:24 - how all that
00:15:26 - works. This whole process can be a little bit time-consuming
00:15:29 - and quite frankly, since there is a lot of typing, it is full
00:15:32 - of potential for human error, which I seem to be very, very good
00:15:37 - at. So I wanted to go ahead and do all of this in advance and
00:15:40 - then show you what I did. So for example, what I did here was
00:15:43 - I just booted WinPE. This is the WinPE that we used earlier in
00:15:47 - our series here. And this is the first screen that appears, and
00:15:50 - it's going to ask me what language and things I want to do in
00:15:52 - installation. Normally, I would click on Next, except I'm not
00:15:55 - interested in doing an installation right here because this would
00:15:58 - install it on to a physical hard drive in a normal file structure.
00:16:02 - I want to create a VHD. So what I did was I pressed Shift+F10,
00:16:06 - and that then brought me to this screen right here, where I typed
00:16:10 - in "diskpart." With Diskpart, I wanted to identify what disks
00:16:14 - I had. Now I have got two disks. I really only needed one, but
00:16:17 - I just happened to have two. So I typed "list disk" and it shows
00:16:20 - me the both of them. Then I have to know which disk I want to
00:16:24 - select. I want to select the first one and I want to install
00:16:26 - the operating system and the VHD on it. So I select disk 0 and
00:16:31 - it's now the selected disk. If there is something that is already
00:16:33 - there and I'm trying to wipe it out, I'll choose clean. Otherwise,
00:16:36 - that's not necessary. Once it's been cleaned, then I need to
00:16:39 - create a partition and it needs to be primary partition.
00:16:44 - Once that's been done, I want to format that, and I use the quick
00:16:48 - option because there is no need for it to take a long time. If
00:16:51 - you don't use the quick option, it takes an extremely long time
00:16:54 - and it is a thorough check of the hard drive, and that's normally
00:16:56 - not necessary. Once that's been completed and formatted, then
00:17:00 - I list the volume. And the reason for doing that is because I
00:17:03 - want to identify or just confirm that I have a volume that's
00:17:06 - now been created and it is the partition right here that we see.
00:17:10 - Notice that when I formatted this, I did not specify NTFS. That's
00:17:14 - because NTFS is the default anyway. The next thing I need to
00:17:17 - do though is I've got to give it a drive letter so that I can
00:17:20 - continue to work with it. So I assign letter=c. Once
00:17:25 - that's been done, then I list the volumes here again just to
00:17:27 - confirm that it did take drive C, and it looks like I'm OK with
00:17:30 - that. Now here is where we get into the virtual disk items.
00:17:34 - I want to create vdisk. Create vdisk. And the name of the file
00:17:39 - is going to be it's going to be on the C drive, which I just
00:17:43 - lettered right here. And I'm going to name it and this is arbitrary.
00:17:46 - You just name this whatever you want. I just called mine WIN7VHD.VHD.
00:17:49 - I gave it
00:17:51 - a maximum size of 40 oops, that's too many, that's right, and
00:17:56 - it gave me an error. I'll put a size there of 400 gigabytes.
00:18:00 - I meant to say 40 gigabytes so it made an error. So I did it
00:18:03 - again and I chose 40 gigabytes. Too many zeroes there. So once
00:18:07 - that had been done, I then had Diskpart
00:18:11 - create that virtual disk for me. And then it will continue on
00:18:15 - here. I think I'll just type the rest of these. I haven't done
00:18:17 - the rest of these yet. So once that vdisk has been created, next
00:18:21 - thing I need to do is to select that vdisk. So I'll select vdisk
00:18:25 - file=c:\, and then it would be WIN7VHD.VHD.
00:18:31 - So I have selected that item. And in order to make it useful
00:18:36 - so that it can be installed to or be used in a native way, I'm
00:18:41 - going to attach
00:18:45 - vdisk and press Enter. Now it's successfully attached that virtual
00:18:49 - disk file. Once I've got that virtual disk file attached here,
00:18:53 - I need to treat it as if it were a physical disk. Have I formatted
00:18:58 - that physical disk yet? No. I've formatted the disk that holds
00:19:02 - the VHD, but the VHD itself right now just looks like a raw disk.
00:19:07 - It needs to be formatted. In fact, let's go ahead and choose
00:19:09 - list disk here. And you can see that I've got it right here,
00:19:14 - but if I choose list volume
00:19:17 - that it doesn't really have any there is nothing there. So I
00:19:20 - have to take this disk 2 and I need to go ahead and create a
00:19:24 - partition on there. So since I'm still focused on that VHD file,
00:19:28 - I'll choose create partition
00:19:32 - primary. And then I'll go ahead and format that as well.
00:19:40 - After that's been formatted then, I'm also going to go ahead
00:19:42 - and assign it a drive letter. It doesn't matter really what letter
00:19:46 - you assign it. Normally, you would think of drive C or something
00:19:48 - like that. But it doesn't matter. This is only for temporary
00:19:51 - purposes. On the first boot, it will normally reassign itself
00:19:54 - to drive C anyway, even if you give it some different drive letter
00:19:57 - here. So now that we've got that, we are ready to proceed.
00:20:01 - I'll just go ahead and type "exit" out of Diskpart. And then
00:20:06 - from here, we can just type "setup," and it will take us into
00:20:09 - the setup routine, at which point, I'm going to choose a custom
00:20:12 - installation here in a little while after I click Next through
00:20:15 - the introductory parts of this wizard. And then I'm going to
00:20:18 - choose a custom installation. Now look, there is my VHD right
00:20:22 - there. That would not have been exposed if I had not used the
00:20:26 - select vdisk and attach vdisk and then formatted that partition
00:20:31 - and so forth. This would otherwise have been unavailable. Now
00:20:35 - I notice something interesting, and this is something you can
00:20:37 - ignore. It does say that Windows cannot be installed on disk
00:20:40 - 2 partition 1 right here. That's not true. You can. Just click
00:20:43 - on Next and continue on through your installation. And you can
00:20:46 - see that's it's already copying and expanding the files to that
00:20:49 - partition, that
00:20:51 - VHD. All right. Now we have a fully installed system. I paused
00:20:54 - recording while the installation completed itself, and then I
00:20:57 - also wanted to show you a few things here as well. If I just
00:21:01 - opened up My Computer right here, notice that we have the local
00:21:04 - disk here and you can tell that it's a 40 gigabyte disk. That's
00:21:07 - where the operating system is installed. Remember I said earlier
00:21:10 - that this is all actually in a VHD, but there is no way to know
00:21:13 - that. In fact, if I did this on a user's computer, they would
00:21:16 - probably never know that they were actually running off of a
00:21:19 - VHD. The only other way that they might know is if on this
00:21:22 - local disk they look, there is the VHD itself. And what this
00:21:27 - is is everything that they see when they double click on drive
00:21:31 - C. So that's what we've actually got going on here. And then
00:21:35 - I also wanted point out that in the boot properties, if you used
00:21:40 - bcdedit /v, this shows you verbose information about the boot
00:21:44 - environment. We can see that it's booting from a VHD device here
00:21:48 - and it names the file there as well. And then finally here
00:21:52 - also, if we go into Computer Management, you can again see here
00:21:56 - that there is the VHD file that's mounted right here, and you
00:22:00 - can tell that by again, there is a visual indicator here that
00:22:02 - it gives you kind of a blue hard drive there. That's your only
00:22:05 - other visual indicator. Otherwise, it looks pretty much the same.
00:22:09 - And you wouldn't want to detach this right now. I guess I could
00:22:11 - try it, but you wouldn't want to detach it because then you wouldn't
00:22:13 - have an operating system anymore. But that's pretty much the
00:22:16 - basics of how doing a clean install to a VHD would work. The
00:22:22 - next thing to consider then would be how to deploy a WIM file
00:22:26 - to a VHD. Now the WIM file could just be the install.wim that
00:22:30 - appears on the Windows 7 DVD. And
00:22:34 - in my case, I'm going to be using a Windows 7 Enterprise install.wim
00:22:39 - file when I demonstrate this here in a little while. By the
00:22:42 - way, this is important to know, you can only do this thing where
00:22:46 - you boot to a VHD with Windows 7 Enterprise or Ultimate Edition.
00:22:52 - That's it. So I can't do it with Professional. I can't do it
00:22:55 - with Home Edition, anything else. Only Enterprise and Ultimate.
00:23:00 - So the overall view of how you would do this though, if you
00:23:03 - wanted to deploy a WIM file to VHD, was you need to start pretty
00:23:07 - much the same. You'd still boot to WinPE. You'd still get to
00:23:10 - a command prompt by using Shift+F10. You'd still go to Diskpart.
00:23:14 - And then you would create the partitions necessary both on the
00:23:18 - physical disk to create a partition to hold the VHD, and then
00:23:23 - you would create a VHD on that physical disk. Once that's been
00:23:28 - created, you also need to then format and partition that VHD
00:23:33 - file as well, and it has to be attached using Diskpart. Then
00:23:37 - what you would do is you would copy the WIM file to the VHD drive
00:23:42 - itself. And then you would use the familiar command that we've
00:23:45 - seen before, ImageX, and you would simply apply that WIM file.
00:23:50 - And in the same way that you would do if it were just physical
00:23:52 - hardware only and not using
00:23:55 - a VHD. Then you would detach vdisk and then what you would
00:23:59 - do normally is you would copy your VHD file. That's what you'll
00:24:03 - be copying. You'll copy that VHD file to a server. And this is
00:24:07 - what we're going to primarily be doing if you want to take that
00:24:10 - VHD and deploy it to other computers in similar fashion to what
00:24:14 - we've done with WIM files in the past. Now once you've got
00:24:18 - the VHD up to the server, then you connect some other client,
00:24:21 - some other computer, and you copy that VHD file to the client.
00:24:26 - And then what you'll do is you'll run the BCD boot command to
00:24:29 - make sure that it properly boots. Now, there is a lot of steps
00:24:33 - in between the lines here, and I want to point out something
00:24:36 - that I'll show you how all of these works, and then I'll show
00:24:39 - you a reference so that you can step through it yourself if you
00:24:41 - want to. All right. Now what we did here was I simply booted
00:24:45 - to the imaging WinPE that I created in an earlier point in time.
00:24:49 - This is where we used OS CD image and everything to create our
00:24:52 - ISO file. And we've used the same ISO in the past. Anyway,
00:24:57 - I went ahead and booted to it. Now the reason why I wanted to
00:24:59 - use this particular one as opposed to just booting from WinPE
00:25:04 - off of the Windows 7 installation DVD is because this one will
00:25:08 - also include ImageX, which I'm going to need. So here I've got
00:25:12 - this launched. And by the way, I didn't type this in. This is
00:25:15 - going to automatically launch any time you boot off of that WinPE
00:25:18 - disk. And what that is part of is that launch part of what's
00:25:22 - involved in launching and initiating the network. That's why
00:25:25 - I'm going to be able to map network drives later on. So anyway,
00:25:28 - the first thing I typed though was diskpart, and this is very
00:25:31 - similar to what I did earlier. I see that I've got disks that
00:25:33 - I listed here. I selected one of them. I cleaned it. Again, you
00:25:37 - don't have to do that unless there is already something there
00:25:40 - that you want to get rid of. Then what I did was I created a
00:25:43 - primary partition. Again, all the same stuff that we did before.
00:25:46 - Formatted it quick. Then I listed the volumes just to double
00:25:50 - check. I've got a volume 1 right here. I wanted to assign a drive
00:25:55 - letter to that volume. By the way, you know that this is the
00:25:59 - selected volume when you see an asterisk next to it. So I assigned
00:26:03 - it letter C. And then what I did was I created a vdisk file.
00:26:07 - This again is the same thing I did earlier. I just made this
00:26:09 - a little bit smaller because it copies up and down to the server
00:26:13 - faster and it's only for demonstration purposes so it's fine
00:26:16 - for that. Also, I made it expandable. I could have also typed
00:26:20 - type=fixed as opposed to expandable. The expandable one also,
00:26:25 - for lab purposes and for virtual machine types of purposes and
00:26:28 - so forth and copying, will copy up and down faster. If it's a
00:26:33 - physical machine that I actually plan to use, then you would
00:26:36 - probably want to make that fixed instead because it will perform
00:26:40 - better in the long term. So anyway, once that's been done,
00:26:43 - again, I'll select a vdisk file and it's the vdisk file that
00:26:46 - I just created. Once that's been done, here is the key. I need
00:26:50 - to make it look like a hard drive, so I have to attach vdisk.
00:26:54 - Again, I think all of this stuff is the same stuff we already
00:26:57 - did in the previous method. But things will get different here
00:27:01 - in a little while here. Once I've attached this vdisk, then
00:27:05 - I want to create a partition primary and assign a drive letter.
00:27:09 - Again, it doesn't matter what the drive letter is, but I chose
00:27:11 - V for VHD to make it easier to remember. Then you can format
00:27:15 - that and give it a label, and that's pretty much it. Then you're
00:27:18 - ready to move on to the next set of steps. So then, once I had
00:27:22 - formatted that and given it a label, then I'm done with diskpart
00:27:26 - for now so I can type exit to get out of diskpart. Then what
00:27:29 - I'd do is I go to drive letter D and I type in net use n: And
00:27:34 - remember earlier in this, we saw the WinPE init
00:27:39 - or something like that. And that's where part of the network
00:27:41 - was being started. If the network is not started, then as I mentioned
00:27:44 - in an earlier nugget, just type start net and that will launch
00:27:48 - the network for you. Then I just ran net use n:. I'm using
00:27:53 - map to drive letter N. Again, you can map whatever drive letter
00:27:55 - you want to my computer. And I just used the administrative share
00:27:59 - there because I never actually shared a folder. And then I fat
00:28:03 - fingered the credentials so I had to do it again. But anyway,
00:28:06 - I entered in the credentials here properly, and I was able to
00:28:09 - get to that drive. Once I had gotten that drive letter mapped
00:28:14 - to drive letter N, then what I did was I want to use an existing
00:28:18 - WIM file that's already over there, and that would be the image,
00:28:21 - so I used ImageX, and then I wanted to apply a specific image.
00:28:25 - That's on the map letter N which I just showed you. It's in the
00:28:29 - WIM files directory. And this is the name of the WIM file. It
00:28:32 - is the Windows 7 Enterprise edition. That's a 64-bit image. I'm
00:28:37 - choosing the first and only image or installation in that WIM
00:28:42 - file, and I'm going to apply it to drive
00:28:46 - V. So I let it do its thing, took a little bit of time, eight
00:28:49 - minutes or so right here, and that was pretty much it for that
00:28:52 - part of it. Once that had been applied, I needed to return
00:28:55 - to diskpart, so I choose diskpart, selected vdisk file right
00:29:00 - here. Then I wanted to detach the virtual disk. Why is that?
00:29:05 - Because I need to take this file and I need to transport it or
00:29:09 - copy it over to a server so that I can use it for other purposes
00:29:14 - or other deployments to other computers. I cannot do that for
00:29:17 - as long as it's attached, so I had to detach it, exited diskpart,
00:29:22 - and then I copied that WIN7VHD
00:29:25 - file to my network drive in a VHD folder. And that in fact is
00:29:30 - the folder that we looked at earlier here on my physical computer
00:29:33 - that D, my Images, is on drive D. And then you can see here,
00:29:38 - if I scroll down a little bit, that there is on my D drive, there
00:29:41 - is a VHD folder and there is WIN7VHD. That's exactly what I was
00:29:46 - looking for. So I successfully copied that file over, and that's
00:29:50 - pretty much all there was to it. There had been a previous one
00:29:53 - there. I just overwrote it. But that's all we had.
00:29:57 - And then we continue on. And by the way, I know that there
00:29:59 - is a lot of commands here and you're probably looking and just
00:30:01 - saying, "Boy, I'll never in a million years memorize all of this
00:30:04 - stuff." Well, I don't think you need to memorize it. You just
00:30:06 - kind of need to know the overall flow of how this goes. And if
00:30:10 - you want to duplicate these steps, then I'm going to take you
00:30:14 - to a website which has all of these for you, so you don't have
00:30:18 - to write all these down or anything like that. But this will
00:30:20 - give you the basic idea of what you need to do. Anyway, once
00:30:22 - we've created our partition, let me go back up, and assigned
00:30:24 - a letter, we exit diskpart. And then what we do is we wanted
00:30:28 - to copy the VHD file that we had copied out to my server earlier
00:30:32 - or to my machine earlier, and then I wanted to copy that, so
00:30:37 - I'm copying that and that's pretty much what we did. And then
00:30:40 - we have diskpart here. And now I'm going to select the vdisk
00:30:44 - file that I just copied.
00:30:47 - Once that's been selected, I need to attach that vdisk. Once
00:30:50 - that's been done, I went ahead and listed the volumes just to
00:30:53 - confirm what we have. I have volume 3 drive letter V and that's
00:30:58 - the WIN7VHD
00:31:00 - file, VHD partition.
00:31:02 - Then I exited that. And now what I need to do, and this is important
00:31:05 - for the boot process, as I changed and ran cd, and I also changed
00:31:12 - the drive as well as the directory; cd /d means to change the
00:31:15 - drive to the V drive and in this directory. And you can see here
00:31:20 - that that this indeed where I wound up. And then what I did
00:31:23 - when I got there was I wanted to use this command: bcdboot.
00:31:27 - This is important in order to be able to create the boot configuration
00:31:32 - data. That's what BCD is. Otherwise, if I were to stop ahead
00:31:36 - of this, then if I restarted the computer, there would be no
00:31:38 - way to boot into that image that I just copied down.
00:31:43 - So I do bcdboot and then v:\windows.
00:31:47 - This folder here has all the files necessary to create a boot
00:31:51 - environment, so it copies those system files out of there to
00:31:56 - the S drive. And remember earlier that we assigned it drive letter
00:32:01 - S. Once that was done, I returned to diskpart. You can see
00:32:05 - how critical diskpart is to this whole process, and then I selected
00:32:08 - the vdisk file here again, the VHD. I detached it and then I
00:32:13 - exit. And once that's been done, we're now pretty well ready
00:32:17 - to restart this computer, and it should boot right into the
00:32:22 - VHD. Now I mentioned earlier that I would take you to a website
00:32:24 - that will identify all of this stuff for you. If you take note
00:32:28 - of the URL up here at the top, Microsoft has a TechNet article
00:32:32 - that takes you through a walk-through of how to deploy a virtual
00:32:35 - hard disk for a native boot. And that's exactly what we did here.
00:32:39 - Only a couple of things I want to point out to you here in
00:32:42 - this whole process. One of them is an error and one of them is
00:32:45 - a preference. Let me show them to you. And the first item there
00:32:48 - is a preference really but it's under step three if you scroll
00:32:51 - down here. You'll see that it tells us to create a partition
00:32:54 - primary size of 300. Remember that's where I created a partition
00:32:57 - of 100. The fact of the matter is this is just going to be
00:33:01 - where the system boot files are, and it doesn't really need 300
00:33:04 - megabytes. In fact, it doesn't even need 100 megabytes. But a
00:33:08 - default installation of Windows will automatically create 100-megabyte
00:33:11 - partition, so I just said, hey, why am I using 200 extra megabytes?
00:33:14 - Anyway, you don't have to do it that way. You can use 300, you
00:33:18 - can use 100, whatever you want to do, but you only need 100.
00:33:22 - And then the other thing is further away on down here, if you
00:33:25 - take a look, oh there it is. If we take a look here under step
00:33:29 - four, then it says copy this file, and they just called theirs
00:33:33 - Windows7.vhd. I called mine WIN7VHD.vhd. Just whatever names
00:33:37 - you want for these. But they have you copying it to drive C.
00:33:41 - That's not what you'll do if you're staying consistent with all
00:33:44 - of their drive letters here. They should have put drive letter
00:33:47 - W there. So just note that because otherwise, you'll drive yourself
00:33:50 - crazy trying to get it on drive C. So change that to a W. Otherwise,
00:33:54 - that's pretty much it. And Microsoft really did, really, a very
00:33:56 - nice job otherwise with this whole document, and I think you'll
00:34:00 - find that if you practice through this once or twice, then you'll
00:34:03 - have a pretty good grip on hands-on experience on how to do this
00:34:07 - yourself. And then here, we actually have the install operating
00:34:10 - system. I rebooted it in the background while I was showing you
00:34:12 - that Web page, and that's pretty much it. We now have a good
00:34:17 - system up and running. I had run diskpart here as well again
00:34:20 - that lists the disks for you. Here is disk 2 which contains the
00:34:24 - VHD, and that's where the VHD would be. Here are the volumes.
00:34:28 - Again, it's the WIN7VHD volume, which is our 24-gigabyte volume
00:34:32 - that we created. And so now we're pretty well good to go. And
00:34:36 - this one it's booting from, it's booting from that 100-megabyte
00:34:39 - partition. And if you want to look at that another way as well,
00:34:42 - I've also got the computer management open here. Again, that's
00:34:45 - going to be our system active primary partition. And again, this
00:34:49 - is the Microsoft way of describing things. This is the system
00:34:52 - partition but it has the boot files on it. This is the boot partition
00:34:56 - but it actually has the system files on it. Nice and confusing,
00:34:59 - right? Anyway, that's where our operating system is located,
00:35:02 - is right through here. Now once you've got your VHDs up and
00:35:05 - running and you like the way they're operating at all, you're
00:35:08 - going to periodically need to update them. Maybe you have a new
00:35:10 - version of an application that's included in that VHD that you
00:35:13 - deploy to your clients. Maybe you have a new update that you
00:35:16 - also want to apply, similar kinds of things to what we looked
00:35:19 - at when we were talking about updating WIM files. Well, how
00:35:22 - do you update a VHD? One of the things you can do is to just
00:35:26 - continue to update your WIM files and then to apply them inside
00:35:30 - of your VHD files. That's not really on the whiteboard here,
00:35:33 - but that would be just one simple way of doing that. So that's
00:35:36 - a kind of obvious way. Also, if you wanted to directly update
00:35:41 - the VHDs, guess what? Really, you can't
00:35:44 - because the only way to really do that directly using default
00:35:47 - tools is that you would use something called the offline virtual
00:35:51 - machine servicing tool which you can download. But in order to
00:35:54 - use that tool, you also have to have Systems Center Virtual Machine
00:35:57 - Manager, which is another part of the Systems Center family.
00:36:01 - So that's really a totally different server, a totally different
00:36:03 - topic, everything. It's not really directly even related to Windows
00:36:07 - 7, but that would be the direct way to do that. And what this
00:36:11 - would do is it would boot your VHD client. Once it boots it,
00:36:15 - it only keeps it up long enough so that it can apply the updates
00:36:18 - from your Windows Server Updates Services server or a Systems
00:36:21 - Center Configuration Manager Update Server, and it applies those
00:36:25 - updates. And then it immediately will reboot into your normal
00:36:29 - operating system. So that's kind of the way that that particular
00:36:32 - tool works, but again, you have to have system center infrastructure
00:36:36 - in order to use it, and you need to use the System Center Virtual
00:36:39 - Machine Manager. Now for offline servicing, another thing you
00:36:43 - can do would be to use the attached item that's within disk management,
00:36:47 - or you could use vdisk. Either one works. But for example, if
00:36:50 - I wanted to do that right now, maybe for example, our WIN7VHD
00:36:55 - file didn't
00:36:57 - have all of the updates it needed or I needed to add some files
00:37:00 - to it or something like this. Well, I could attach the VHD and
00:37:03 - I could just attach my WIN7VHD
00:37:07 - right here and click Open. Now if I just want to examine it
00:37:11 - and kind of poke around in there and see what's going on, I could
00:37:13 - open up as read-only, and that would certainly be recommended
00:37:16 - in many cases because if you're just curious or something or
00:37:19 - just exploring, you wouldn't want to accidentally delete files
00:37:22 - or do something that would damage the functionality of that VHD.
00:37:26 - But otherwise, I would leave that cleared then click OK. And
00:37:30 - then what we will see happen here is we see that it mounts it
00:37:32 - right here and there it is. Now I can just explore that just
00:37:36 - as if it were any other hard drive on my computer. It's pretty
00:37:41 - equivalent to if this VHD were an installed
00:37:45 - Windows operating system on a physical hard drive and then I
00:37:49 - just plugged it into one of my serial ATA connections on my motherboard,
00:37:53 - and there it is, powered it up, and here it is. Now I could add
00:37:57 - files to this. I could add driver files to this. I could do whatever
00:38:01 - I want to, add data files, whatever, and that would pretty much
00:38:04 - be it. By the way, speaking of data, this is not really an
00:38:06 - exam issue, but kind of the question that comes up sometimes
00:38:10 - with folks is, "Should I create a data drive here as well and
00:38:13 - that's where I keep all of my user files and things like that?"
00:38:16 - Preferably not. You don't normally want to use this for that.
00:38:20 - Normally, you want to put your data files on another partition
00:38:23 - or on an additional drive instead if you're going to use VHD
00:38:27 - files. And another way to do that in the corporation would
00:38:31 - be to not have users save their files locally anyway but to use
00:38:34 - home directories or redirected documents folders that point to
00:38:39 - the home directories. So anyway, that's a little bit of data
00:38:43 - about that. Once you're done with this, then of course you
00:38:45 - would then detach oops, where is it? You would then detach the
00:38:50 - VHD here. I went off-screen. So let me bring it up so you can
00:38:52 - see it. Right click here. Choose Detach VHD. And then what you
00:38:57 - could do as well is you could delete the virtual hard disk file
00:39:00 - after removing the disk. I don't really want to delete that because
00:39:03 - I'm using it. So I'll click OK here, and that would pretty much
00:39:06 - be it, and now you can see that it's all gone away, and that's
00:39:09 - pretty much the end of that. In this Nugget, we talked about
00:39:12 - imaging, and this is Part 4, where we talked about VHD advantages,
00:39:16 - the fact that you can use a common set of tools, that it's a
00:39:19 - single file that you manage instead of multiple files, and many
00:39:22 - other things related to VHDs. We also talked about how to create
00:39:26 - a VHD. Remember, you can use the Disk Management console or you
00:39:29 - can use Diskpart utility. The VHD, you can do a clean install
00:39:34 - to it, and when you do that, it would then be a native VHD boot,
00:39:38 - and it would look and feel pretty much like a conventional installation.
00:39:43 - Also, we talked about how to deploy an existing WIM file, whether
00:39:45 - it's a default install.wim or a reference.wim that you've created
00:39:50 - to a VHD, just another way of doing a deployment. Remember,
00:39:54 - if you want to actually update
00:39:57 - a VHD file offline, you are going to have to use something from
00:40:00 - the System Center Virtual Machine Manager product family to do
00:40:03 - that, or if you want to just service it by adding or removing
00:40:06 - files, for example, then you can also just mount that in an existing
00:40:09 - Windows Server 2008 R2 or Windows 7 machine using Disk Management.
00:40:15 - Otherwise, you'll have to use the Virtual Machine Manager tools. All
00:40:19 - right. I hope this has been informative for you, and I'd like
00:40:21 - to thank you for viewing..

Configuring Devices

Managing Disks

Managing Applications

Application Restrictions

Internet Explorer

IPv4 Networking

IPv6 Networking

Wireless Networking

Windows Firewall

Remote Administration

Accessing Resources Part 1

Accessing Resources Part 2

Authentication and User Account Control

Remote Access

Mobile Computing

Monitoring Systems

Configuring Performance

Windows Updates

Backup and Recovery

Please help us improve by sharing your feedback on training courses and videos. For customer service questions, please contact our support team. The views expressed in comments reflect those of the author and not of CBT Nuggets. We reserve the right to remove comments that do not adhere to our community standards.

comments powered by Disqus

Course Features

Speed Control

Play videos at a faster or slower pace.

Bookmarks

Pick up where you left off watching a video.

Notes

Jot down information to refer back to at a later time.

Closed Captions

Follow what the trainers are saying with ease.

NuggetLab

Files/materials that supplement the video training

Premium Features

Transcender® Practice Exams

These practice tests help you review your knowledge and prepare you for exams.

Offline Training

Our mobile apps offer the ability to download videos and train anytime, anywhere offline.

Accountability Coaching

Develop and maintain a study plan with assistance from coaches.
James Conrad

James Conrad

CBT Nuggets Trainer

Certifications:
CompTIA A+, Server+; Certified Ethical Hacker; Microsoft MCSA, MCSE, MCITP, MCTS

Area Of Expertise:
Microsoft, including Windows Server, Windows Server administration, and Active Directory Design; hacking and security; photography and digital imaging. Author of the Server+ Guide to Advanced Hardware Support.


Stay Connected

Get the latest updates on the subjects you choose.


  © 2014 CBT Nuggets. All rights reserved. Licensing Agreement | Billing Agreement | Privacy Policy | RSS