PowerCLI

  • 1.  get nested information

    Posted Apr 27, 2017 07:54 PM

    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



  • 2.  RE: get nested information
    Best Answer

    Posted Apr 27, 2017 08:33 PM

    Try like this

    Get-VMHost -VM czovamii0001 | Get-Datastore



  • 3.  RE: get nested information

    Posted Apr 28, 2017 03:32 AM

    thanks :smileyhappy: