List all datastores and disk names

List all datastores and disk names

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
  }
}

PowerCLI script to list all datastores and the disk names of the partitions.

A sample output of this script is:

Name                        DiskName
----                        --------
esxi01_boot                 naa.600a0b80001111550000fb9cf54f414d
esxi02_boot                 naa.600a0b80001111550000850e884f414d
cluster01_gold_001          naa.600a0b80001111550000778bc952494d
cluster01_silver_001        naa.600a0b8000111155000074088c52494d
cluster01_bronze_003        naa.600a0b80001111550000e451a8ed794e
esxi03_boot                 naa.600508b4001078340000e00004c00000
esxi04_boot                 naa.600508b4001078340000e00002c60000
cluster02_gold_001          naa.600508b400055c680000800000dc0000
cluster02_silver_001        naa.600508b4001078340000e00004bb0000
cluster02_bronze_001        naa.600508b4001078340000e00002cb0000

 

Source linkĀ 

Your email address will not be published. Required fields are marked *