VMware Cloud Community
sivagndl
Enthusiast
Enthusiast
Jump to solution

Vm-inventory-with NNA

Hi ,

We required a inventory in complete data center  like VMName,vmhost,Datastore,DatastoreNNA,clusterName.


Output like

VMName: Name of VM

VMhost: HostIP

Datastore: Name of datastores

NNA: Datastore identifier

Cluster : cluster Name

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM |
Select Name,@{N="VMHost";E={$_.Host.Name}},
 
@{N="Cluster";E={Get-Cluster -VM $_ | Select -ExpandProperty Name}},
 
@{N="Datastore";E={[string]::Join(',',(Get-View $_.ExtensionData.Datastore | Select -ExpandProperty Name))}},
 
@{N="NAA";E={[string]::Join(',',(Get-View $_.ExtensionData.Datastore | %{$_.Info.Vmfs.Extent | %{$_.DiskName}}))}} 


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-VM |
Select Name,@{N="VMHost";E={$_.Host.Name}},
 
@{N="Cluster";E={Get-Cluster -VM $_ | Select -ExpandProperty Name}},
 
@{N="Datastore";E={[string]::Join(',',(Get-View $_.ExtensionData.Datastore | Select -ExpandProperty Name))}},
 
@{N="NAA";E={[string]::Join(',',(Get-View $_.ExtensionData.Datastore | %{$_.Info.Vmfs.Extent | %{$_.DiskName}}))}} 


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

Reply
0 Kudos
sivagndl
Enthusiast
Enthusiast
Jump to solution

Thanks Lucd, That's Grate

Reply
0 Kudos