Hi,
I am trying to write a script that lists the data store name, the cluster it belong to and the ID in a format that looks about like this:
CLUSTERNAME DATASTORE_NAME naa.xyz123xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I poked around and found 2 scripts that do each of the parts, but I cannot figure out how to merge them, so so speak.
Data store and cluster name:
Get-Cluster -PipelineVariable cluster |
Get-Datastore |
select @{N='Cluster';E={$cluster.Name}}Name, Type, FilesystemVersion, State, Accessible | Out-GridView
Get data store name and ID:
Get-Datastore | where{$_.Type -eq 'VMFS'} |
Select Name,
@{N='LUN';E={$_.ExtensionData.Info.Vmfs.Extent.DiskName -join ' | '}}
Now, can anyone explain how I merge these, getting the
@{N='LUN';E={$_.ExtensionData.Info.Vmfs.Extent.DiskName -join ' | '}}
to be part of the first script?
You could just copy that calculated property to the 1st script
Get-Datastore |
select @{N='Cluster';E={$cluster.Name}},Name, Type, FilesystemVersion, State, Accessible,
@{N='LUN';E={$_.ExtensionData.Info.Vmfs.Extent.DiskName -join ' | '}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I must have placed the value wrong somehow.
Anyways, that works like a charm 🙂
Thanks.
Would it be possible to show the Disk space size in total for each VMFS datastore?
Do you mean the capacity, like this?
Get-Datastore |
select @{N='Cluster';E={$cluster.Name}},Name, Type, CapacityGB,FilesystemVersion, State, Accessible,
@{N='LUN';E={$_.ExtensionData.Info.Vmfs.Extent.DiskName -join ' | '}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you, Luc, for the assistance in this matter.