Automation

 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; 
    @{DiskName=naa.60002ac000000000000000520001d142}

    it is possible to remove extra characters like below in the script?
    naa.60002ac000000000000000520001d142

     

    Here is the script i am using

    $filelocation="C:\temp\Datastore_List.csv"

    Get-Datastore |
    Select @{N='Datacenter';E={$_.Datacenter.Name}},
    @{N='DSC';E={Get-DatastoreCluster -Datastore $_ | Select -ExpandProperty Name}},
    Name,CapacityGB,@{N='FreespaceGB';E={[math]::Round($_.FreespaceGB,2)}},
    @{N='ProvisionedSpaceGB';E={
    [math]::Round(($_.ExtensionData.Summary.Capacity - $_.Extensiondata.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted)/1GB,2)}},@{N='NAAID';E={$_.ExtensionData.Info.Vmfs.Extent | Select DiskName}},
    @{N='UnCommittedGB';E={[math]::Round($_.ExtensionData.Summary.Uncommitted/1GB,2)}},
    @{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.





  • 3.  RE: Datastore NAAID Display

    Posted Jul 06, 2022 06:19 PM

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