sivagndl
Enthusiast
Enthusiast

Vm-inventory-with NNA

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership

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

0 Kudos
2 Replies
LucD
Leadership
Leadership

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

0 Kudos
sivagndl
Enthusiast
Enthusiast

Thanks Lucd, That's Grate

0 Kudos