John,

Here is the working funciton (modified) It adds the UplinkKey paramater.

Thanks for your help.

------------------------------------------------

function Add-dvSwHost{
param($dvSwitch, $hostMoRef, $pnic, $nrUplink,$UplinkKey)

$spec = New-Object VMware.Vim.DVSConfigSpec
$tgthost = New-Object VMware.Vim.DistributedVirtualSwitchHostMemberConfigSpec
$tgthost.operation = "add"
$tgthost.backing = New-Object VMware.Vim.DistributedVirtualSwitchHostMemberPnicBacking
0..($nrUplink - 1) | % {
$tgthost.Backing.PnicSpec += New-Object VMware.Vim.DistributedVirtualSwitchHostMemberPnicSpec
$tgthost.Backing.PnicSpec[$_].pnicDevice = $pnic[$_]
$tgthost.Backing.PnicSpec[$_].UplinkPortGroupKey = $UplinkKey
}
$tgthost.host = $hostMoRef
$spec.Host = $tgthost
$dvSwitch.UpdateViewData()
$spec.ConfigVersion = $dvSwitch.Config.ConfigVersion

$taskMoRef = $dvSwitch.ReconfigureDvs_Task($spec)
$task = Get-View $taskMoRef
while("running","queued" -contains $task.Info.State){
$task.UpdateViewData("Info")
}
}