Windows


I see a cycle coming. I think Azure is a fairly compelling idea, but it makes me wonder what the company I work for will do going forward. We have obviously seen economies of scale work to a corporation’s advantage. So will large corporations like mine be better off negotiating cloud rates with Microsoft based on a certain amount of volume? If so what would this do to developer productivity?

Instead of the developer just being able to create a new environment, I can just see these companies putting process in place to provision the new environment in their configured way. Thus it would raise the maturity level, but reduce productivity. Imagine having an “Azure Development Workspace” catalog item where it has to go through approval chains and get lots of people involved.

It may sound cynical, but it seems every time something comes out that is supposed to simplify life, we add process (as opposed to guidelines) for formal structure and thus make life more complicated and expensive.

Copyright © Scott P. Rudy 2009 All Rights Reserved
Advertisements

Earlier this month I wrote how you can mount a VHD using the command line utility DiskPart. This is an extremely useful utility, but sometimes you just want the simplicity of using the Windows GUI interface. Well, in Windows 7 the Disk Management MMC snap-in makes this a breeze.

The easiest way to load the snap-in is to open Computer Management by right-clicking on the “Computer” link in the Windows start menu and choosing “Manage”. This action will open a whole host of utilities you can use to manage your computer, but for this exercise you will only need to use the Disk Management link located in the left pane under Computer Management\Storage. Once you click on Disk Management it may take Windows a few seconds to find all of your storage devices and display them in the right pane.

Once the storage devices have loaded you can click on the Action menu at the top of the window. You now have the “Attach VHD” menu option. Simply click that option and select the VHD file you want to attach.

Detaching the file is a little more confusing. To detach it you have to navigate to the disk in the bottom pane of the Disk Management utility. The left most column in that pane is a series of buttons with the disk name shown. Right click on the disk name (e.g. Disk 2 in the image below) and select “Detach VHD”. Ensure you don’t check the delete checkbox, unless you don’t want any data on the VHD anymore.

 

detach

Copyright © Scott P. Rudy 2009 All Rights Reserved

If you are running the Business, Enterprise or Ultimate version of Windows Vista or Windows 7 you can use the Windows Backup and Restore Center to conduct full hard drive backups of your computer. All you need is enough storage media that can accommodate the used portion of your hard drive. While you could use CD or DVD storage, the simplicity of using a large external USB hard drive is much more convenient, especially with the size of some of the hard drives shipped out today.

This feature has been long overdue in the Windows world, but it now provides some great reassurance. Full backups simply place your files into VHD files. However, what happens when you backup your machine and then reinstall an OS from scratch? How do you get the files off of your VHD. Well, if you are running Vista you need to use a tool like VHDMount that ships inside the Windows Virtual Server 2005 R2 sP1, unless you have a Windows 7 install CD handy and you swap out the boot loader by looking at one of my previous posts.

You can’t install VHDMount on Windows 7, but you don’t need to either. The built-in DISKPART utility allows you to mount VHD files as a drive letter just like VHDMount. Simply locate your VHD file and use the following commands in a command prompt with elevated privileges.

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\users\scottrudy\>DISKPART

Microsoft DiskPart version 6.1.7600
Copyright (c) 1999-2008 Microsoft Corporation.
On computer: SCOTTRUDY

DISKPART> SEL VDISK file="E:\…\1c44c446-91c0-11dd-8709-806e6f6e6963.vhd"
DiskPart successfully opened the virtual disk file.

DISKPART> ATTACH VDISK
DiskPart successfully attached the virtual disk file.

When you are finished simply type DETACH VDISK to unmount the file.

Copyright © Scott P. Rudy 2009 All Rights Reserved

I am normally one of the first to jump aboard and start playing with a new OS. For some reason, however, I have been holding off on running Windows 7. I imagine a big part of it has to with the length of time it took me to get my Vista image right and the fear that I would forget something by reinstalling the OS (I don’t usually do upgrades). I did try the first release of Windows 7 on a VM, but the performance of the PC I used was just abysmal.

Just last weekend I decided to try something I had heard Scott Hansleman mention on show #458 on .Net Rocks. Apparently it is possible to boot off a VHD (virtual hard disk) using the Windows 7 boot loader. What Scott mentioned though is that it is possible to overlay the Windows Vista boot loader with that of Windows 7. There a few hurdles to jump before you can even begin installing, however, as this isn’t as simple as creating a VPC VHD file (which doesn’t natively work)

Note – you will not be able to place the VHD file on a disk that is encrypted by BitLocker or some other encryption sofware. So if you don’t have another partition you might want to look at running DiskPart to shrink the encrypted partition and create a new unencrypted one at least 10 GB long (although I recommend at least 30 GB).

Step 1) First, you have get a copy of the Windows 7 image by downloading it from Microsoft. The file comes in the form on an ISO image and you need a way to get the files out of it. You can either burn the image to a DVD or use a tool that allows you to mount the image onto the file system. I recommend burning the image to DVD, as you will need it later anyway.

Step 2) The next step is the most tedious. You need to locate the boot loader. There are two ways to do this. The “easiest” way is to install Windows 7 somewhere, like a VPC image, and copy the files from the installed copy. If you do this you can skip to step 4.

Step 3) If you are feeling a bit more adventurous you might try to download the Windows 7 AIK (which contains the ImageX command line tool) and the gImageX tool. These two tools will allow you to open the WIM file that holds the boot loader, boot.wim. The boot.wim file is located at \sources on the Windows 7 install disk. In order to use gImageX I recommend you create a new folder called ImageX for the exe. Then I recommend copying the following files from the \Program Files\Windows AIK\Tools\platform folder into the new folder, imagex.exe, wimgapi.dll, winmount.inf, winmount.sys, winmountinstall.exe and wimserv.exe. Once you have done that double click the gImageX.exe file and click the Mount tab. You will need to choose a folder for the mountpoint and use the boot.wim file as the source. Leave the image as “1” and click the Mount button.

Step 4) To get the Windows 7 boot loader files you will need to create a new folder and go to the root of the Windows 7 installation (or mountpoint if you are following the adventurous path). You need to copy the \Windows\Boot\PCAT\bootmgr and the \Windows\System32\bcdedit.exe files to the new folder.

Step 5) Modifying the Windows Vista boot loader while Vista is running proves to be a difficult task, so the files need to be placed in some accessible place on the Vista machine you plan to install Windows 7 on. Make note where you copied these files as it will be important later. If you have disk encryption (e.g. BitLocker) running you will need to turn it off at this point in order to make modifications to the boot loader.

Step 6) Now you need to place the Windows 7 installation DVD (I told you would need it later) into your Windows Vista PC and reboot. You may have to go into your BIOS settings to ensure your PC can boot from a CD ROM, but you should see the Windows 7 installer come up.

Step 7) Click the next button on the intro screen and then choose “Repair your computer”. Then choose “Restore your computer using a system image that you created earlier” and click Next.  Windows may or may not find an image, but either way you need to click Cancel until you see a “System Recovery Options” window. At this point you will want to choose “Command Prompt”.

Step 8) At this point you will need to locate the boot loader files you copied earlier, in step 5. You will need to copy them over the existing files on the Vista OS drive. The driver letters at this command prompt are possibly different than the ones you usually see in Windows Vista, so you may need to look for the drive that has a Windows directory in it by using the “cd” (change directory) and “dir” (directory listing) commands. You will want to copy the bootmgr file to the \Windows\Boot\PCAT\ folder and the bcdedit.exe file to the \Windows\System32\ folder.

Okay now the boot loader is in place so you just need to prep a VHD file and start the install…

Step 9) I recommend creating the vhd file in a new folder on the partition you want the file to be stored(remember it cannot be BitLocker encrypted) . You can do this by executing a “mkdir” (Make Directory) command and then navigating to that folder using “dir”.  Type the following command set into the command line:

diskpart
create vdisk file=YourDriveLetter\YourPath\win7.vhd maximum=30270 type=expandable
attach disk
exit
exit

Step 10) Close the “System Recovery Options” window by clicking the [X] (DO NOT click the shutdown or restart buttons). Click “Install Now” and then select the newly create disk which show as a disk with unallocated space.

Step 11) After Windows 7 installs you should see a new boot menu on load that allows you to run Windows 7 (off a VHD with full hardware support) and one for Windows Vista.

Don’t forget to turn disk encryption (e.g. BitLocker) back on in your Windows Vista OS if you temporarily disabled it.

Copyright © Scott P. Rudy 2009 All Rights Reserved