Hello,
I am curious if there is a way to move VMs into Folders using the FolderID.
Back Story
Reimporting a couple hundred VMs from Datastore migration. The reimport is working great. Since the company has a number of sub-level folders with the same name in the same cluster, we need to be sure the VMs go into the correct folder.
I have the FolderID that these VMs were in. It would be excellent if I can just MOVE-VM using the FolderID. I have tried a few simple scripts and they have failed.
I also reviewed this post:
I am assuming that would work in my case, it would be extremely impractical. I was thinking maybe using a CSV file and with Folder and FolderID, do some sort of IF Statement.... Something like
Get-Folder -Name $_.Folder |
If ($._ParentID -match $_.FolderID) ....
Something like that.. I cant get the syntex correct. Plus not sure how to have it keep looking after second failure.. get it in some sort of loop.
Thanks
Boston Tech Guy