VMware Cloud Community
wolficool
Contributor
Contributor
Jump to solution

Move VM to VM Subfolder in VC

Hello,

i want to move a exist VM in vCenter into a VM Subfolder that naming is for example like these:

testdc\vm\Workloads\test-workloads\test-ab

I have added these folder path in to avriable.

also the vm is in the $vm variable with Get-VM...

But when i want to move the vm into the cm subfolder with Move-VM $vm -Destination $vmfolder i receive the error:

Move-VM Could not find VIContainer with name 'testdc\vm\Workloads\test-workloads\test-ab'

For info: the subfolder here for example, exists many more in other vm Subfolder...

So how can i just move the exists vm into the right vm folder???

 

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Use Get-Folder to get a Folder object pointing to that specific folder.
Then use that Folder object on the Destination parameter.

To get a Folder object from a folderpath, you might want to have a look at my Folder by Path post.


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Use Get-Folder to get a Folder object pointing to that specific folder.
Then use that Folder object on the Destination parameter.

To get a Folder object from a folderpath, you might want to have a look at my Folder by Path post.


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

wolficool
Contributor
Contributor
Jump to solution

Many Thx LucD 🙂

It works great.

0 Kudos