Monday, August 9, 2010

Creating a WinPE 3.0 bootable CDROM for extending the C partition on VMware

VMware makes it very easy to grow the size of an underlying disk. With Windows 2008R2 you can extend the file system online. With Windows 2003 you can extend the file system of any drive except the system drive (the C drive usually) online using diskpart extend. To extend the system drive there are a number of work-around methods such as attaching the drive to a second VM.

I decided to create a WinPE 3.0 bootable CDROM ISO to use as an alternative method--partly to play with WinPE 3.0. I wanted to include the pvscsi drivers from VMware 4.1 and use a Windows 2008 R2 base. It turned out to be pretty straight-forward.

First download the Windows Automated Intallation Kit software from Microsoft and install it on a VM that has VMware 4.x tools installed. The kit is identical for Windows 7 and 2008 R2. You can use it on a 32-bit or 64-bit version of Windows. I tried out both successfully but stuck with the 64-bit version.

Here is a script that you can run that will build the ISO. Run it in an elevated "Deployment Tools Command Prompt" after you install the kit. It will copy the VMware SCSI drivers from the VM and create an ISO that upon boot will extend the C drive and shutdown the VM. Depending on the version of Windows and VMware tools you may not have both the pvscsi and scsi drivers, but if there is no specialized driver the included Windows driver should work.

  • set targetdir=c:\winpe
  • copype.cmd %PROCESSOR_ARCHITECTURE% %targetdir%
  • Copy %targetdir%\winpe.wim %targetdir%\ISO\Sources\boot.wim
  • xcopy "%ProgramFiles%\vmware\VMware Tools\Drivers\pvscsi\*.*" %targetdir%\drivers\pvscsi\*.* /e
  • xcopy "%ProgramFiles%\vmware\VMware Tools\Drivers\scsi\*.*" %targetdir%\drivers\scsi\*.* /e
  • Dism /Mount-WIM /WimFile:%targetdir%\ISO\Sources\boot.wim /index:1 /MountDir:%targetdir%\mount
  • Del %targetdir%\ISO\boot\bootfix.bin
  • echo select volume=c > %targetdir%\mount\Windows\System32\diskpart.ini
  • echo extend noerr >> %targetdir%\mount\Windows\System32\diskpart.ini
  • echo list volume >> %targetdir%\mount\Windows\System32\diskpart.ini
  • echo [LaunchApps] > %targetdir%\mount\Windows\System32\winpeshl.ini
  • echo diskpart.exe, "/s diskpart.ini" >> %targetdir%\mount\Windows\System32\winpeshl.ini
  • echo wpeutil.exe, shutdown >> %targetdir%\mount\Windows\System32\winpeshl.ini
  • Dism /image:%targetdir%\mount /Add-Driver /Driver:%targetdir%\drivers /recurse
  • dism /unmount-wim /mountdir:%targetdir%\mount /commit
  • oscdimg -n -b%targetdir%\ %targetdir%\ISO %targetdir%\winpe_%PROCESSOR_ARCHITECTURE%_extend.iso

Thursday, August 5, 2010

SQL 2008 R2 Sysprep slightly worse than nothing

I'm just going to say it, I don't see a use for SQL 2008 R2 SysPrep.

I'm generally so happy with SQL 2008R2, people often pretend they aren't with me when I get started. Really, if I want to look vaguely normal, I have to be seen with people with an even more fanatical dedication to their product like Mac users, or our SharePoint administrator. That's why it's slightly painful (although vaguely reassuring as regards my sanity), that I'm super disappointed with the much touted SysPrepability of SQL 2008 R2.

Really, as far as I can tell, it's slightly worse than nothing at all. You can only prep the database engine, reporting services, and the browser (not even the client tools and SSIS!). You can tell the prep install all you want that you want the base instance install to go to a location other than c:\program files, but it apparently knows better. It not only defaults back to c:\program files, but greys out the ability to change it once you run the complete install. It knows better than you what you want, even if you explicitly told it what you want. As far as I can tell, you can't even set the browser service to automatic, or set a default data and log location in the SysPrep.

The Microsoft article on SQL SysPrep is here

The only useful thing I can see is that it requires you to copy the install files locally so that they're already included in a template (but, surprisingly, I'm actually capable of copying files to a template anyway). I also find it weird that the SysPrep comes up as evaluation edition until it's fully installed (this is noted in the SysPrep article).

Just a big bummer, back to old school template unattended installs for me. If anyone has cool ways to make SysPrep fancy or, you know, useful, I'd love to hear about them.