Hello
As you know most of the vcenter folder structures are nested.
I only want to get main folders in vcenter.(I have only one datacenter)
As far as i know there is recurse feature in Powershell . If you write -depth and its degree, it only gives you the specific directory that is given the depth by you.
Similarly how can we indicate depth in powercli especially to get only main folders?
You could do
Get-Datacenter | Get-Folder -Name vm | Get-Folder -NoRecursion
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Euh, Get-Folder with the NoRecursion switch?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Mr. Luc
When i write "Get-Folder -NoRecursion" it only gives one folder which it's type datacenter. Is is root folder.
At the attachment you will see there are 16 folders inside "xxx Datacenter"
I want to get only these 16 folders.
I currently don't have access to a system, but after reading the documentation, I'd try s.th. like:
Get-Folder -Location (Get-Folder -NoRecursion)
André
You could do
Get-Datacenter | Get-Folder -Name vm | Get-Folder -NoRecursion
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you Mr Luc. It works.
By the way why did we pipe Get-Datacenter and get-folder and get folder again?
Hello Andre Thanks for your replay. But it gave me the whole folders including child folders