2 Replies Latest reply on Sep 16, 2020 12:04 AM by mrray

    Get cluster and ID per data store

    mrray Novice

      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?