Hi,
i´m searching for a little script that generates an output (table? / csv?) of the Datastores ( NFS ) attached to a cluster.
I want the script to show
Datastore-Name
NFS-Server
path ( on NFS-Server )
How has such a script to look like?
Thx
Chakoe
Wait a minute, which PowerCLI version are you using ?
Do a
Get-PowerCLIVersion
If I remember correctly these properties are new in PowerCLI 5
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try something like this
$report = foreach($cluster in Get-Cluster){ Get-Datastore -Entity (Get-VMHost -Location $cluster) | where {$_.Type -eq "NFS"} | Sort-Object -Unique | Select @{N="Cluster";E={$cluster.Name}},Name,RemoteHost,RemotePath } $report | Export-Csv "C:\NFS-datastores.csv" -NoTypeInformation -UseCulture
If you want it for a specific cluster change the first line into
$report = foreach($cluster in (Get-Cluster -Name MyCLuster)){
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc,
this reports the same results as the simple Get-Datastore. Means: Only Name, FreeSpaceMB and CapacityMB are shown with values. RemoteHost and RemotePath are still empty
Are you sure you copied the script correctly ?
Works fine for me and shows the Remote Host and Path.
I'll attach the script to make sure you have the correct copy.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good morning,
the Script is:
$report = foreach($cluster in Get-Cluster -Name Cluster23){
Get-Datastore -Entity (Get-VMHost -Location $cluster) |
where {$_.Type -eq "NFS"} |
Sort-Object -Unique |
Select @{N="Cluster";E={$cluster.Name}},Name,RemoteHost,RemotePath
}
$report | Export-Csv "C:\NFS-datastores.csv" -NoTypeInformation -UseCulture
And its output in the csv is:
"Cluster";"Name";"RemoteHost";"RemotePath"
"Cluster23";"Cluster23_01";;
"Cluster23";"Cluster23_02";;
"Cluster23";"Cluster23_03";;
"Cluster23";"Cluster23_04";;
"Cluster23";"Cluster23_05";;
"Cluster23";"Cluster23_06";;
"Cluster23";"Cluster23_GW_RZ2_1";;
So, whats going wrong? For example, here are the Values ( in VI-Client) of the Datastore Cluster23_01
Identification: Cluster23_01
Server: 10.17.1.251
Path: /qvm03_001
Wait a minute, which PowerCLI version are you using ?
Do a
Get-PowerCLIVersion
If I remember correctly these properties are new in PowerCLI 5
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Had the same idea 🙂
just upgaded to Version 5 et voila 🙂
Thx a lot!