VMware Cloud Community
taskino
Enthusiast
Enthusiast
Jump to solution

Datastore NAAID Display

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!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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 '|'}},




Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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 '|'}},




Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
taskino
Enthusiast
Enthusiast
Jump to solution

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

0 Kudos