Tuesday, December 1, 2015

Run this PowerCLI script to map the .naa disk name to the datastore name on an ESXi host

Connect-VIServer -Server "server_name" -User "user_name" -Password "password"
Get-Datastore |
Where-Object {$_.ExtensionData.Info.GetType().Name -eq "VmfsDatastoreInfo"} |
ForEach-Object {
  if ($_)
  {
    $Datastore = $_
    $Datastore.ExtensionData.Info.Vmfs.Extent |
    Select-Object -Property @{Name="Name";Expression={$Datastore.Name}},
      DiskName
  }
}