-- Ben Armstrong, Virtualization Program Manager
Talking about core virtualization at Microsoft (Hyper-V, Virtual PC and Virtual Server).
Normally when people ask me for a specific VBScript, I just do a web search and point them to the most promising looking result. The other day I was asked for a script to convert a dynamic virtual hard disk to a fixed size virtual hard disk - and was surprised to find that no one had already published one. So for the sake of posterity:
set vsApp = CreateObject("VirtualServer.Application","localhost") TargetVHDpath =Inputbox("Enter path and name of VHD to convert:")FixedVHDpath =Inputbox("Enter path and name of VHD to create") set target = vsApp.GetHardDisk(TargetVHDpath) set convertTask = target.convert(FixedVHDpath,1) while not convertTask.isComplete wscript.echo "Conversion is " & convertTask.PercentCompleted & "% complete" WScript.Sleep 2000wend wscript.echowscript.echo "Conversion complete"
set vsApp = CreateObject("VirtualServer.Application","localhost")
TargetVHDpath =Inputbox("Enter path and name of VHD to convert:")FixedVHDpath =Inputbox("Enter path and name of VHD to create")
set target = vsApp.GetHardDisk(TargetVHDpath)
set convertTask = target.convert(FixedVHDpath,1)
while not convertTask.isComplete wscript.echo "Conversion is " & convertTask.PercentCompleted & "% complete" WScript.Sleep 2000wend
wscript.echowscript.echo "Conversion complete"
Two things to note:
Cheers,Ben