Virtualization Technology News and Information
Article
RSS
CODE: Inspect Microsoft Virtual Server Virtual Hard Disks

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.

 

Published Sunday, August 06, 2006 12:30 PM by David Marshall
Filed under:
Comments
There are no comments for this post.
To post a comment, you must be a registered user. Registration is free and easy! Sign up now!
Calendar
<August 2006>
SuMoTuWeThFrSa
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789