I am trying to get a list of child folders under hosts and clusters. I need to generat a list of folder directly below a given folder but i have have no luck. Can anyone help?
get-folder | get-childitem
Truth is a three edged sword
In the VI hierarchy of objects there are some hidden folders present.
These you don't see in the VIC but you can see them with Managed Object Browser (http://<VC-server>/mob).
For the folders created under the Hosts & Clusters node you can do
Get-Folder Datacenters | Get-Folder -NoRecursion
The folder Datacenters is the hidden folder that corresponds with the Hosts & Clusters node.
Since you only want to see the child folders we add the parameter -NoRecursion.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
In the VI hierarchy of objects there are some hidden folders present.
These you don't see in the VIC but you can see them with Managed Object Browser (http://<VC-server>/mob).
For the folders created under the Hosts & Clusters node you can do
Get-Folder Datacenters | Get-Folder -NoRecursion
The folder Datacenters is the hidden folder that corresponds with the Hosts & Clusters node.
Since you only want to see the child folders we add the parameter -NoRecursion.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference