...hopefully some useful VMware related stuff

Datastore Information script showing ESX and datastore name paths and multipathing settings

25/05/2010 12:00

A great script by LucD on the VMware community forums: https://communities.vmware.com/thread/269695

Download HERE

 

- - - - - - - - - - - - - - - - - - - -

# Script to Show Datastore Info (Multipathing etc.)
# LucD

$report = @()

Get-VMHost  | Get-View | %{
 $esx = $_
 $esx.Datastore | %{Get-View $_} | where {$_.SUmmary.Type -eq "VMFS"} | %{
   $ds = $_
   $ds.Info.Vmfs.Extent | %{
    $ext = $_
    $extKey = ($esx.Config.StorageDevice.ScsiLun | where {$_.CanonicalName -eq $ext.DiskName}).Key
    $lun = $esx.Config.StorageDevice.MultipathInfo.Lun | where {$_.Lun -eq $extKey}
 
    $row = "" | Select ESXname, DSname, "Path Selection","Paths Total"
    $row.ESXname = $esx.Name
    $row.DSname = $ds.Name
    $row."Path Selection" = &{
     switch($lun.Policy.Policy){
      "VMW_PSP_FIXED"{"Fixed"}
      "VMW_PSP_RR"{"Round Robin"}
      "VMW_PSP_MRU"{"Most Recently Used"}
     }
    }
    $row."Paths Total" = $lun.Path.Count
    $report += $row
   }
 }
}
$report

Search site