Am trying to list shared datastores in between the clusters in vcenter
Get-Datastore | where{$_.ExtensionData.Summary.MultipleHostAccess} | select Name, Datacenter, Cluster, Host |ft -AutoSize
It is not giving the host-name and cluster name in which Datastore is shared so we can restrict the datastore only to the required cluster.
Sure, try like this
where{$_.ExtensionData.Summary.MultipleHostAccess} |
ForEach-Object -Process {
$_.ExtensionData.Host |
where{$_.MountInfo.Mounted} |
Select @{N='Datatsore';E={$ds.Name}},
@{N='DSC';E={(Get-DatastoreCluster -Datastore $ds).Name}},
@{N='Datacenter';E={$ds.Datacenter}},
@{N='Cluster';E={(Get-Cluster -VMHost (Get-View -Id $_.Key -Property Name).Name).Name}},
@{N='VMHost';E={(Get-View -Id $_.Key -Property Name).Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could do something like this
where{$_.ExtensionData.Summary.MultipleHostAccess} |
ForEach-Object -Process {
$_.ExtensionData.Host |
where{$_.MountInfo.Mounted} |
Select @{N='Datatsore';E={$ds.Name}},
@{N='Datacenter';E={$ds.Datacenter}},
@{N='Cluster';E={(Get-Cluster -VMHost (Get-View -Id $_.Key -Property Name).Name).Name}},
@{N='VMHost';E={(Get-View -Id $_.Key -Property Name).Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
can i also add sDRS cluster name if datastores are part of sDRS.
Select @{N='Datatsore';E={$ds.ClusterName}},
Sure, try like this
where{$_.ExtensionData.Summary.MultipleHostAccess} |
ForEach-Object -Process {
$_.ExtensionData.Host |
where{$_.MountInfo.Mounted} |
Select @{N='Datatsore';E={$ds.Name}},
@{N='DSC';E={(Get-DatastoreCluster -Datastore $ds).Name}},
@{N='Datacenter';E={$ds.Datacenter}},
@{N='Cluster';E={(Get-Cluster -VMHost (Get-View -Id $_.Key -Property Name).Name).Name}},
@{N='VMHost';E={(Get-View -Id $_.Key -Property Name).Name}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference