VMware Cloud Community
Lajosh
Contributor
Contributor
Jump to solution

get nested information

Hello all,

I recently started to dig around Powershell and PowerCLI. Currently Im working on a script to configure VM - add several disks. I need the disks to be added to correct datastore on the host where the VM is located. Im able to achieve this info doing following:

$myvm = Get-VM czovamii0001

$myhost = $myvm.vmhost

$myhost | Get-Datastore

which results in object with that host datastores.

My question is, can I somehow achieve this using one command via pipe? Cant figure out.

THX

Leos

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-VMHost -VM czovamii0001 | Get-Datastore


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 like this

Get-VMHost -VM czovamii0001 | Get-Datastore


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

Reply
0 Kudos
Lajosh
Contributor
Contributor
Jump to solution

thanks Smiley Happy

Reply
0 Kudos