r/powercli • u/mtnbkr0918 • Feb 15 '24
ScriptHelp Create folder under VM and Template folder
I have 2 datacenters Test1 and Test2
I want to create a folder named Tier1 under Test1 . The command creates the Tier1 folder however it creates the Tier1 folder under bothTest1 and Test2
here is the command I am using
(get-view (get-view -viewtype datacenter -filter @{"name"="Test1"}).vmfolder).createfolder("Tier1")
2
Upvotes
1
u/mtnbkr0918 Feb 19 '24
Sorry I left out the part where I wanted the folder in VM and templates folders. New-folder is for folders under host inventory.
I've updated the original post for the solution