VMware Cloud Community
pdirmann01
Enthusiast
Enthusiast

Functionality Request - Advanced Cross vCenter Server vMotion Capability - Include Tags

Could we see about adding functionality to move the tags over with the VM? If the category and/or tag doesn't exist, create them. If they do exist, just add them to the VM. Prior to adding the Cross vCenter vMotion into vCenter 7.0U1, I was using a PowerCLI script to do my vMotions and moving the tags was a requirement because that's how backups were managed and they provided insight into the purpose and criticality of the VM. I remmed out a chunk of the code, and this code obviously assumes that the categories and tags pre-exist (we have a "sync" script to keep all tags and categories in sync between the different SSO domains.

$vmList = ("VM1", "VM2", "VM3")

..
..
..
 
$vmTagList = Get-TagAssignment $vmList
ForEach ($vm in $vmList) { 
    ForEach ($tag in $vmTagList) {
        If ($tag.Entity.Name -eq $vm) {
            New-TagAssignment -Entity $vm -Tag $tag.Tag.Name -Server $vcfWLVC -WhatIf
        }
    }
}
Reply
0 Kudos
0 Replies