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..????
You could use the script from .
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could use the script from .
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I seem to be getting an error
You cannot call a method on a null-valued expression.
At :line:30 char:21
+ if(($dev.gettype( <<<< )).Name -eq "VirtualDisk"){
Can you attach the script you are using ?
I have no line 30
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Strange if i run the same script pointing to a diffrent Vcenter is works..?????????????? Point it back I get the same error
Any ideas ???
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.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes exactly the same version ..was working ok till this afternoon..
Think i will have do give it a chinese cure " reboot vCenter"....
Yes good old "Reboot" Vcenter solved the problem..
My next task is
1) how to add the Percentage of the RDM used .. ( Monitor the space left on the RDM)
2) List all RDM with less than 10% free
Did you figure out?
I am searching for how to monitor and report the details RDM disks on important VMs (i.e. the physical disk RDMs without logical disk letters that are associated wiht Exchange 2007 Storage Groups)
I would like to be able to report on free space remaining.
Thanks in advance..
What you're asking for is a bit more than what I see above.
Check out this script from Hugo Peeters. He mixes PowerCLI with WMI calls to fill in guest information. I assume it will work for volumes without drive letters but if not I bet you can tweak it slightly to what you need.
=====
Carter Shanklin
Read the PowerCLI Blog
[Follow me on Twitter|http://twitter.com/cshanklin]
Thank you for the pointer. If it is what I'm after; great. If I'm able to tweak it. I'll post it.