In the VI client when you view storage information you see the Identification of the datastore and in the next column Device.
This Device property is not available when you use Get-Datastore, is there a way to dig a bit deeper and find it? I need to list out all my datastores and the information in that device column.
Thanks
Have a look at the script I gave in .
If you only want the DS name and the Device you can use the condensed version below.
function Get-DSDevice($dsImpl) { $ds = Get-View -Id $dsImpl.Id $esx = Get-View $ds.Host[0].Key $hss = Get-View $esx.ConfigManager.StorageSystem foreach($mount in $hss.FileSystemVolumeInfo.MountInfo){ if($mount.volume.name -eq $ds.Info.Name){ switch($mount.Volume.Type){ "VMFS" { foreach($ext in $mount.Volume.Extent){ if($mount.volume.name -eq $ds.Info.Name){ $device =$ext.DiskName + ":" + $ext.Partition } } } "NFS" { $device = $mount.Volume.RemoteHost + ":" + $mount.Volume.RemotePath } } } } $device } $report = @() Get-Datastore | %{ $row = "" | Select dsName, dsDevice $row.dsName = $_.Name $row.dsDevice = Get-DSDevice $_ $report += $row } $report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Have a look at the script I gave in .
If you only want the DS name and the Device you can use the condensed version below.
function Get-DSDevice($dsImpl) { $ds = Get-View -Id $dsImpl.Id $esx = Get-View $ds.Host[0].Key $hss = Get-View $esx.ConfigManager.StorageSystem foreach($mount in $hss.FileSystemVolumeInfo.MountInfo){ if($mount.volume.name -eq $ds.Info.Name){ switch($mount.Volume.Type){ "VMFS" { foreach($ext in $mount.Volume.Extent){ if($mount.volume.name -eq $ds.Info.Name){ $device =$ext.DiskName + ":" + $ext.Partition } } } "NFS" { $device = $mount.Volume.RemoteHost + ":" + $mount.Volume.RemotePath } } } } $device } $report = @() Get-Datastore | %{ $row = "" | Select dsName, dsDevice $row.dsName = $_.Name $row.dsDevice = Get-DSDevice $_ $report += $row } $report
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Brillant, thanks for the quick response.