Hi all I have created a datastore report with specification to SCSI LUN ID and NFS export path.
But I have no idea to query the NFS export path of a datastore. Can you help me in the following script?
$report = @()
$VMHost = Get-VMHost -Location
$cluster foreach($cluster in Get-Cluster){
(Get-Datastore -VMHost $VMHost | where {$_.Type -eq "VMFS"}) | %{
$info = "" | select DataCenter, Cluster, Name, Capacity, Provisioned, Available, DSType, State, LUNid, NFSPath
$info.Datacenter = $_.Datacenter
$info.Cluster = $cluster.Name
$info.Name = $_.Name
$info.Capacity = [math]::Round($_.capacityMB/1024,2)
$info.Provisioned = [math]::Round(($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)
$info.Available = [math]::Round($info.Capacity - $info.Provisioned,2)
$info.DSType = $_.Type
$info.State = $_.State
$info.LUNid = Get-ScsiLun -Datastore $_
$info.NFSPath = "n/a"
$report += $info
}
(Get-Datastore -VMHost $VMHost | where {$_.Type -eq "NFS"}) | %{
$info = "" | select DataCenter, Cluster, Name, Capacity, Provisioned, Available, DSType, State, LUNid, NFSPath
$info.Datacenter = $_.Datacenter
$info.Cluster = $cluster.Name
$info.Name = $_.Name
$info.Capacity = [math]::Round($_.capacityMB/1024,2)
$info.Provisioned = [math]::Round(($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)
$info.Available = [math]::Round($info.Capacity - $info.Provisioned,2)
$info.DSType = $_.Type
$info.State = $_.State
$info.LUNid = "n/a"
$info.NFSPath = "I don't know"
$report += $info
}
Thanks.