View Only
  • 1.  Datastore NAAID Display

    Posted Jul 06, 2022 06:10 PM

    Hello Everyone,

    I have the following script that works well for getting datastore information and exporting csv. When i export to csv datastore NAAID shows up like this; 

    it is possible to remove extra characters like below in the script?


    Here is the script i am using


    Get-Datastore |
    Select @{N='Datacenter';E={$_.Datacenter.Name}},
    @{N='DSC';E={Get-DatastoreCluster -Datastore $_ | Select -ExpandProperty Name}},
    [math]::Round(($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)}},@{N='NAAID';E={$_.ExtensionData.Info.Vmfs.Extent | Select DiskName}},
    @{N='VM';E={$_.ExtensionData.VM.Count}} | Export-Csv -Path $filelocation -NoTypeInformation -UseCulture



    Thank you!

  • 2.  RE: Datastore NAAID Display
    Best Answer

    Posted Jul 06, 2022 06:15 PM

    The Extent property is an array, that is why your Select-Object shows the DiskName in that format.
    Since a VMFS datastore can have more than 1 Extent, you can "join" the DiskNames.
    Which will also solve the notation format you see.

      @{N='NAAID';E={$_.ExtensionData.Info.Vmfs.Extent.DiskName -join '|'}},

  • 3.  RE: Datastore NAAID Display

    Posted Jul 06, 2022 06:19 PM

    Wow!!! Thank you LucD. That was quick! Worked flawlessly!