Automation

 View Only
  • 1.  Powershell script to get VMDKs

    Posted Jun 19, 2009 06:55 PM

    Hi!

    Can anyone help me with a small powershell script to get this below info:

    1) VM Name

    2) VMDK Name

    3) Size in GB

    I have a few VM's which have a couple of VMDK's (O.S and Data).

    Any quick help is deeply appreciated.

    Thank you

    Hugo



  • 2.  RE: Powershell script to get VMDKs

    Posted Jun 19, 2009 07:01 PM

    I could look for you, but you may have better luck in the VMware vSphere™ PowerCLI Forum

    ....or take a look at lamw's



  • 3.  RE: Powershell script to get VMDKs

    Posted Jun 19, 2009 07:22 PM

    one other thing I forgot to add is RVTools



  • 4.  RE: Powershell script to get VMDKs

    Posted Jun 30, 2009 02:46 PM

    Hello,

    Moved to the PowerCLI forum.


    Best regards,

    Edward L. Haletky VMware Communities User Moderator, VMware vExpert 2009, Virtualization Practice Analyst[/url]
    Now Available: 'VMware vSphere(TM) and Virtual Infrastructure Security: Securing the Virtual Environment'[/url]
    Also available 'VMWare ESX Server in the Enterprise'[/url]
    [url=http://www.astroarch.com/wiki/index.php/Blog_Roll]SearchVMware Pro[/url]|Blue Gears[/url]|Top Virtualization Security Links[/url]|Virtualization Security Round Table Podcast[/url]



  • 5.  RE: Powershell script to get VMDKs

    Broadcom Employee
    Posted Jun 30, 2009 03:20 PM

    Hi,

    Try this:

    Connect-VISserver MYVISERVER
    $report = @()
    Get-VM | Foreach {
    	$row = "" | select Name, Disk, CapacityGB
    	Foreach ($Disk in $_.HardDisks){
    		$row.Name = $_.Name
    		$row.Disk = $Disk.Filename
    		$row.CapacityGB = ($Disk.CapacityKB / 1MB)
    		$report += $row
    	}
    }
    $report
    

    If you found this information useful, please consider awarding points for Correct or Helpful.

    Alan Renouf