Monday 9 January 2012

Create VHD during install of Win 7/2008

Create VHD using Windows 7/2008 install process

  1. Boot your machine with a blank hard drive using the Windows 7 DVD.
  2. Click next on the language screen if English is appropriate.
  3. SHIFT+F10 to launch a WinPE command console. Although the commands below are in upper case, the commands are not case sensitive. I am only using upper case for readability here.
  4. Enter DISKPART to run the utility.
  5. LIST DISK to see the available disks in your system. I am assuming a single raw disk.
  6. SEL DISK 0
  7. CREATE PARTITION PRIMARY
  8. FORMAT FS=NTFS QUICK
  9. LIST VOL
  10. ASSIGN
  11. LIST VOL
  12. CREATE VDISK FILE=c:\windows7rc.vhd MAXIMUM=200000 TYPE=EXPANDABLE
  13. SELECT VDISK FILE=c:\windows7rc.vhd
  14. ATTACH VDISK
  15. CRE PART PRI
  16. FORMAT FS=NTFS QUICK
  17. ASSIGN LETTER=V:
  18. LIST VOL
  19. LIST VDISK
  20. exit DISPART
  21. exit WinPE command console
  22. Install to the newly created 200GB (fuzzy math) virtual hard disk which looks just like a partition to Windows Setup
  23. Repeat steps 11-18 for the Windows Server 2008 R2 VHD but with the obvious changes for the vdisk filename, size, etc.
Thanks http://blogs.technet.com/keithcombs/


Alternative is (If windows 7 already installed):
1. Create VHD
2. Mount VHD Drive
3. Copy install ISO 7/2008R2 into VHD mounted drive
4. Retart machine and F8 into windows 7 repair
5. From CMD use DISK part to mount VHD Drive
6. CD to mounted VHD drive and run setup
7. Select VHD drive during setup to install to the VHD drive

Finialy the tool to manage vhd images such as size : http://archive.msdn.microsoft.com/vhdtool

No comments: