| Login

Search this Blog


Links I like to keep around


Here are the most recent postings to this blog. Use the archive calendar or search to find other entries.
Dec22

Written by:R Teachout
12/22/2006 5:10 AM 

Reporting the amount of physical hard disk space used by each virtual machine.

From: http://blogs.msdn.com/virtual_pc_guy/archive/2006/09/21/760371.aspx

Option Explicit

Dim strComputer, objWMIService, colVMs, vm, totalDisk

totalDisk = 0
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\vm\virtualserver")
Set colVMs = objWMIService.ExecQuery("SELECT * FROM VirtualMachine",,48)
For Each vm in colVMs
    Wscript.Echo "-----------------------------------"
    Wscript.Echo vm.name & ":: Disk space used: " & _
                        vm.DiskSpaceUsed / 1048576 & _
      " MB (" & vm.DiskSpaceUsed & " bytes)"
    totalDisk = totalDisk + vm.DiskSpaceUsed
Next

    Wscript.Echo "-----------------------------------"
    Wscript.Echo "All virtual machines"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Disk space used: " & totalDisk / 1048576 _
   & " MB (" & totalDisk & " bytes)"

The nice thing is that it gives you the total disk usage, even when the virtual machine

Be sure to read his entire "Developing on Virtual Server" blog

http://blogs.msdn.com/virtual_pc_guy/archive/tags/Developing+on+Virtual+Server/default.aspx

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment  Cancel 

Even as a longtime critic of the company, I must admit that Microsoft occasionally flirts with the truth. Well, perhaps 'flirt' is too strong a word. Let's just say Microsoft sometimes honks and waves as it drives by her house.
-InfoWorld Editor Nicholas Petreley, 06-14-99

Inspired by Nina