Automation

 View Only
  • 1.  how to get folder information of ESXi host using powercli?

    Posted Dec 29, 2015 01:48 PM

    Hi

    is there any way to folder information of ESXi host using powercli?

    get-folder -location doesn't gives the info .

    Thanks,

    Praveen P



  • 2.  RE: how to get folder information of ESXi host using powercli?

    Posted Dec 29, 2015 01:49 PM

    What info are you looking for ?



  • 3.  RE: how to get folder information of ESXi host using powercli?

    Posted Dec 29, 2015 01:55 PM

    inside vCenter we have Folders and under that, Clusters and followed by Hosts.

    i want to know which hosts are located under which folder?

    Thanks in advance,

    Praveen P



  • 4.  RE: how to get folder information of ESXi host using powercli?

    Posted Dec 29, 2015 02:08 PM

    Does this return the info you are after ?

    Get-VMHost |

    Select Name,@{N='Folder';E={

        $parent = Get-View -Id $_.ExtensionData.Parent

        while($parent -isnot [VMware.Vim.Folder])

        {

            $parent = Get-view -Id $parent.Parent

        }

        $parent.Name

    }}