SHARE
TWEET

Untitled

a guest Jun 2nd, 2011 787 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function Get-VMWareRDMs {
  3. $report = @()
  4. $vms = Get-VM | Get-View
  5. foreach($vm in $vms){
  6.      foreach($dev in $vm.Config.Hardware.Device){
  7.           if(($dev.gettype()).Name -eq "VirtualDisk"){
  8.                if(($dev.Backing.CompatibilityMode -eq "physicalMode") -or
  9.                ($dev.Backing.CompatibilityMode -eq "virtualMode")){
  10.                     $row = "" | select VMName, VMHost, HDDeviceName, HDFileName, HDMode, HDsize, HDDisplayName
  11.                     $row.VMName = $vm.Name
  12.                     $esx = Get-View $vm.Runtime.Host
  13.                     $row.VMHost = ($esx).Name
  14.                     $row.HDDeviceName = $dev.Backing.DeviceName
  15.                     $row.HDFileName = $dev.Backing.FileName
  16.                     $row.HDMode = $dev.Backing.CompatibilityMode
  17.                     $row.HDSize = $dev.CapacityInKB
  18.                     $row.HDDisplayName = ($esx.Config.StorageDevice.ScsiLun | where {$_.Uuid -eq $dev.Backing.LunUuid}).DisplayName
  19.                     $report += $row
  20.                }
  21.           }
  22.      }
  23. }
  24. return $report
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top