VMware Cloud Community
Milk_Man
Contributor
Contributor
Jump to solution

Create Folder in Virtual Machines & Template View

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!

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos
Milk_Man
Contributor
Contributor
Jump to solution

As always, you the man! Thanks!

0 Kudos