Handy little VBScript to inspect virtual hard disks

I recently threw together this short script to allow me to see what size a virtual hard disk was created as, and how much space it is currently using:

'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"

Note that the values returned by SizeInGuest and SizeOnHost are the size in bytes. As such they need to be handled as doubles - and divided by 1048576 in order to get the size in megabytes.

Cheers,
Ben