$OVServers = Get-OVServer

ForEach($OVServer in $OVServers){
    $Enclosure = $OVServer.Name.split('_')[0]
    $VMHost = Get-VMHost -Name $OVServer.ServerName
    $ViServer = $VMHost.Uid.Split("@")[1].Split(':')[0]
    $OldTagAssignment = $VMhost | Get-TagAssignment
    $OldTag = $OldTagAssignment.Tag
    $NewTag = Get-Tag -Category "HPE Enclosure" -Name $Enclosure -Server $ViServer

    If ($OldTag -eq $NewTag){
        
    }
    Else{
        $OldTagAssignment | Remove-TagAssignment -Confirm:$false
        $VMHost | New-TagAssignment -Tag $NewTag
    }
}