VMware Cloud Community
ccstone1
Contributor
Contributor

Specify folder path as location

Hi all,

I need to unregister and reregister a bunch of VM's (many turned invalid after a vCenter upgrade), and am trying to use the PowerCLI to avoid doing it manually. I have a general idea of how to do so, but I'm having trouble setting the folder location of the VM. I'm able to use Get-Folder to find the folder using its name, but is there any way to specify the exact path to the folder when using New-VM? For example, Datacenter\Folder1\Folder2\FolderWhereTheVMShouldBe. Just worried about there being possible duplicate folders if I just use Get-Folder alone.

Thanks!

Chris

0 Kudos
2 Replies
LucD
Leadership
Leadership

Have a look at VMX Raiders Revisited


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
broylesd27
Contributor
Contributor

You can use the "Location" switch to specify a parent folder.  For example.

get-folder -location "Production" "VM Folder"

vs

get-folder -location "TestDev" "VM Folder"

This would distinguish production\VM Folder from TestDev\VMFolder.

0 Kudos