Ben Armstrong offers the masses his latest code sample to help get you on your way with thinking outside of the box for your Microsoft Virtual Server implementation.
This time, he offers a short script to allow you to see what size a virtual hard disk was created as, and how much space it is currently using. Both pieces of information can be extremely valuable.
Please note, the values returned are the sizes in bytes. They need to be divided by 1048576 in order to convert them into megabytes.
'Connect to Virtual Server
Set virtualServer = CreateObject("VirtualServer.Application")
'Create a VHD object with the .VHD file specified on the command line
Set aVirtualHardDisk = virtualServer.GetHardDisk(WScript.Arguments(0))
GuestSize = clng(cdbl(aVirtualHardDisk.SizeInGuest) / 1048576)
HostSize = clng(cdbl(aVirtualHardDisk.SizeOnHost) / 1048576)
'Display information about the disk size
wscript.echo "The virtual hard disk, " & WScript.Arguments(0) & " is "&_
GuestSize & " MB to the virtual machine. It is using " & _
HostSize & " MB space on the host operating system"
Check out the original article and comment on it, here.