Update TCP profiles via iControl

I want to change the TCP profile on a virtual server.

The general steps seem to be:

$i=get-

$i.LocalLBVirtualServer.remove_profile($vipname, $oldprofile)

$i.LocalLBVirtualServer.add_profile($vs, $newprofile)

However when the profile is removed, the setting reverts to the /common/tcp profile. So add_profile() fails with this error:

error_string : 01070097:3: Virtual server /Common/my-virtual-server lists duplicate profiles."

If this was an SSL profile, it would work because remove_profile() causes it to be cleared. But the TCP profile never has an empty value so add_profile() always fails.

What’s the correct way to set a profile of type PROFILE_TYPE_TCP on a virtual server?