Using powershell, I want to create a folder in the Virtual Machines & Templates View beneth a datacenter that has the same name as an existing cluster. I can get the new-folder command to work but it defaults to creating the folder in the Datacenters view.
Tthanks!
If I understand your question correctly you want to create a so-called "blue" folder.
The trick is to know that there are some hidden folders (from the VI Client views) that you need to know to make this work.
In the case of the "Virtual Machines & Templates" view there are folders called "vm" under each datacenter.
This script shows you how to create a "blue" folder
$dcName = <Datacenter-name> $dc = Get-Datacenter -Name $dcName $parent = Get-Folder "vm" -Location $dc New-Folder -Location $parent -Name <your-new-folder-name>
PS: with the Managed Object Browser you can see the complete hierarchy including these "hidden" folders.
Point a browser at https://<VC-server>/mob
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If I understand your question correctly you want to create a so-called "blue" folder.
The trick is to know that there are some hidden folders (from the VI Client views) that you need to know to make this work.
In the case of the "Virtual Machines & Templates" view there are folders called "vm" under each datacenter.
This script shows you how to create a "blue" folder
$dcName = <Datacenter-name> $dc = Get-Datacenter -Name $dcName $parent = Get-Folder "vm" -Location $dc New-Folder -Location $parent -Name <your-new-folder-name>
PS: with the Managed Object Browser you can see the complete hierarchy including these "hidden" folders.
Point a browser at https://<VC-server>/mob
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
As always, you the man! Thanks!