MikeStanton
Contributor
Contributor

Found your question and had the same exact problem. 

I was kind of upset to see you asked this 2 years ago and got no replies.

I figure you're well past this, but thought I'd post the solution for anyone else that is looking at this problem.

I'm using ESX 6.5 and PowerCLI, so I'm not sure if it works for older versions, but I suspect it does.

If you want to tap into vmWare's default net stacks, you have to name your custom stacks exactly as follows, case sensitive.

vMotion = vmotion

Provisioning = vSphereProvisioning

For those who could use some demo code, because I've literally spent 2 days slogging through poorly documented commands:

$vmhost = "EsxServer01"

$vsw = Get-vmHost $vmhost | Get-VirtualSwitch -standard

$portgroup1 = New-VirtualPortGroup -Name "vMotion" -VirtualSwitch $vsw -VLanID 100 -Confirm:$false

$portgroup2 = New-VirtualPortGroup -Name "vMigration" -VirtualSwitch $vsw -VLanID 101 -Confirm:$false

$vmk1 =  "vmk1"

$vmk2 = "vmk2"

$esxcli = Get-Esxcli -VMHost $vmhost

$esxcli.network.ip.netstack.add($null,"vmotion")

$esxcli.network.ip.interface.add($null,$null,$vmk1,$null,9000,"vmotion",$portgroup1.Name)

$esxcli.network.ip.netstack.add($null,"vSphereProvisioning")

$esxcli.network.ip.interface.add($null,$null,$vmk2,$null,9000,"vSphereProvisioning",$portgroup2.Name)

Hope that helps someone.  And if you're looking to use a distributed switch, good luck!