Hi LucD
I have put a simple script to collect all datastore information
The script collecting the Datastore information is working ok however i need to get the Cluster names as well
The issue i have here is I am getting all the cluster names in an array so its incorrect. How can i get the respective cluster name for the storage please
Get-cluster |Get-Datastore |Select-Object ` @{N="Cluster" ;E={Get-cluster |select $($_name)}}, ` @{N="Datastore_Name"; E={$_.name}}, ` @{N="CapacityGB" ; E={[Math]::Round($_.CapacityGB)}},` @{N="FreeSpaceGB" ; E={[Math]::Round($_.FreeSpaceGB)}}, ` @{N="Freespace%" ; E={[Math]::Round($_.FreespaceGB/$_.CapacityGB *100) }}
You could use the PipelineVariable
Get-cluster -PipelineVariable cluster |Get-Datastore |
Select-Object @{N="Cluster" ;E={$cluster.Name}},
@{N="Datastore_Name"; E={$_.name}},
@{N="CapacityGB" ; E={[Math]::Round($_.CapacityGB)}},
@{N="FreeSpaceGB" ; E={[Math]::Round($_.FreeSpaceGB)}},
@{N="Freespace%" ; E={[Math]::Round($_.FreespaceGB/$_.CapacityGB *100) }}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You could use the PipelineVariable
Get-cluster -PipelineVariable cluster |Get-Datastore |
Select-Object @{N="Cluster" ;E={$cluster.Name}},
@{N="Datastore_Name"; E={$_.name}},
@{N="CapacityGB" ; E={[Math]::Round($_.CapacityGB)}},
@{N="FreeSpaceGB" ; E={[Math]::Round($_.FreeSpaceGB)}},
@{N="Freespace%" ; E={[Math]::Round($_.FreespaceGB/$_.CapacityGB *100) }}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you LucD
The solution worked well
Appreciate your help
Many thanks
RXJ