Automation

 View Only
  • 1.  Move VM to VM Subfolder in VC

    Posted Aug 02, 2023 05:13 PM

    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???

     



  • 2.  RE: Move VM to VM Subfolder in VC
    Best Answer

    Posted Aug 02, 2023 05:27 PM

    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.



  • 3.  RE: Move VM to VM Subfolder in VC

    Posted Aug 02, 2023 06:56 PM

    Many Thx LucD

    It works great.