The UplinkPortgroupKey is not a problem, I find that one like this
$uplinkPg = Get-View $dvSwitch.Config.UplinkPortgroup
$pnicSpec.uplinkPortgroupKey = $uplinkPg.Config.Key
Since you have multiple uplink portgroups, that probably needs some extra code to select the correct one, but that can be done based on the UplinkPortName.
The problem is the uplinkPortKey property in the DistributedVirtualSwitchHostMemberPnicSpec object.
In the doc it says that this property is optional, but if you want to specify a specific portkey I assume a value needs to be given.
I tried several ways to find that one, but to no avail till now..
Can you eventually try to use Onyx and see if the method to reconfigure the Nexus is captured ?
Take care to use the correct version depending on your bvSphere version, this app is not downward compatible afaik.