A few days ago, I wrote about what seemed to be an elegant solution to the problem of mounting VHD files within Server 2008 without installing IIS and Virtual Server 2005. Ravi Chaganti came up with a combo VBS and REG file that added the nifty "Mount" and "Dismount" commands to a VHD file. However, mounting a VHD didn't actually bring it online. You could do that in Disk Management, but I was looking for a more automated solution.
And Ravi supplied it, here: http://www.ravichaganti.com/blog/?p=116. This is a batch file that invokes the DISKPART utility, first to figure out the number of the disk that's offline, then to select it and bring it online.
In order to make this script work on Server 2008's version of DISKPART, I had to make two edits to Ravi's script. First, in the FOR loop on line 15, change the capitalization from "offline" to "Offline". Second, in line 23, change "online" to "online disk", so that the full line reads as follows:
echo online disk >> %temp%\vhdonline.dps
When you're done, you can test the batch file separately. Then you can invoke it daisy-chain style from VHDMOUNT.VBS using the WshShell.Run method, as Ravi suggests. Sweet!
Recent Posts:
Glenn Weadock is currently an instructor with Global Knowledge, teaching various Microsoft training courses such as MCSA, MCSE, Server 2008 and Vista tracks.
Global Knowledge offers a comprehensive catalog of Microsoft courses:
Microsoft 2003 MCSA Boot Camp
Microsoft 2003 MCSE Boot Camp
MCITP: Server 2008 Combo Boot Camp
Migrating to Server 2008
Managing and Maintaining Server 2008
More Microsoft Courses
The opinions expressed in this Weblog are those of the writer and may not represent the opinions of Network World.
|
|
VHDMOUNT Script Updates
http://www.ravichaganti.com/blog/?p=241
Post new comment