VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

powercli getvm hard disk c, d etc...

hi

how do I join these 2 together ? I am trying to get output of my vms

NAme, OS version, hard disk1, hard disk2

so I have

get-vm | select Name, @{N="OS"; e={$_.Extensiondata.Guest.GuestFullName}}, @{N="IP Address";E={@($_.guest.IPAddress[0])}}


but I also want


get-vm | get-harddisk | select CapacityGB


Can I combine both in one line and output hard disk1 and 2 in separate columns?


Thank you

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this, the VirtualMachine object is available under the Parent property

Get-VM | Get-Harddisk | Select-Object -Property Name,CapacityGB,

  @{N='VM';E={$_.Parent.Name}},

  @{N = 'OS';E = {$_.Parent.Extensiondata.Guest.GuestFullName}},

  @{N = 'IP Address';E={@($_.Parent.guest.IPAddress[0])}}


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this, the VirtualMachine object is available under the Parent property

Get-VM | Get-Harddisk | Select-Object -Property Name,CapacityGB,

  @{N='VM';E={$_.Parent.Name}},

  @{N = 'OS';E = {$_.Parent.Extensiondata.Guest.GuestFullName}},

  @{N = 'IP Address';E={@($_.Parent.guest.IPAddress[0])}}


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

0 Kudos
tdubb123
Expert
Expert
Jump to solution

thanks Luc that works

0 Kudos