Alternative to VHDMOUNT: Final Thoughts

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: 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:

Adventures in Benchmarking

Hyper-V Manager and Helpless Help

Hyper-V Manager on Vista – final thoughts

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

Copyright © 2008 IDG Communications, Inc.

IT Salary Survey 2021: The results are in