VMware

This Question is Answered

2 "helpful" answers available (6 pts)
9 Replies Last post: Jan 6, 2009 6:17 AM by gboskin  

Get RDM size posted: Jan 6, 2009 12:51 AM

Click to view gboskin's profile Hot Shot 206 posts since
Nov 19, 2008

Hi all and a happy new year to evryone..

The Following script gives a good list of all the RDM ..

$report1 = @()

$vms = Get-VM |Sort Name -Descending | Get-View

foreach($vm in $vms){

foreach($dev in $vm.Config.Hardware.Device){

if(($dev.gettype()).Name -eq "VirtualDisk"){

*if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or *

($dev.Backing.CompatibilityMode -eq "virtualMode")){

$row = "" | select VMName, HDDeviceName, HDFileName, HDMode

$row.VMName = $vm.Name

$row.HDDeviceName = $dev.Backing.DeviceName

$row.HDFileName = $dev.Backing.FileName

$row.HDMode = $dev.Backing.CompatibilityMode

+$report1 = $row

}

}

}

}

$report1 | ConvertTo-Html -title "Virtual Machine information" -body "<H2>RDM information.</H2>" -head "<link rel='stylesheet' href='style.css' type='text/css' />" | Out-File -Append $filelocation


is there a way i can get the actual size (capacity) of the RDms..????

Re: Get RDM size

1. Jan 6, 2009 2:02 AM in response to: gboskin
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
You could use the script from list disks rdm with powershell.
With a minor adaption it will also display the disk capacity.
$report = @()
$vms = Get-VM  | Get-View
foreach($vm in $vms){
  foreach($dev in $vm.Config.Hardware.Device){
    if(($dev.gettype()).Name -eq "VirtualDisk"){
	  if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or 
	     ($dev.Backing.CompatibilityMode -eq "virtualMode")){
	    $row = "" | select VMName, HDDeviceName, HDFileName, HDMode, HDsize
          $row.VMName = $vm.Name
	    $row.HDDeviceName = $dev.Backing.DeviceName
	    $row.HDFileName = $dev.Backing.FileName
	    $row.HDMode = $dev.Backing.CompatibilityMode
           $row.HDSize = $dev.CapacityInKB
	    $report += $row
	  }
	}
  }
}
$report

An RDM is mapped via a .vmdk file.
Through the .vmdk file the size can be obtained.

Re: Get RDM size

3. Jan 6, 2009 2:49 AM in response to: gboskin
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Can you attach the script you are using ?
I have no line 30 :-(

Re: Get RDM size

6. Jan 6, 2009 4:02 AM in response to: gboskin
Click to view LucD's profile Champion 2,430 posts since
Oct 31, 2005
Are you running the samve VC version on both ?
Different versions use different APIs.
It could be that one VC doesn't support all the objects.

Re: Get RDM size

8. Jan 6, 2009 5:52 AM in response to: gboskin
Click to view ief's profile Enthusiast 28 posts since
Aug 19, 2005
Make sure you are connected to the vc


blog www.ivobeerens.nl

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities