Azure Pack Hyper-V NVGRE Powershell SCVMM Windows Server

Hyper-V 2012 R2 NVGRE Gateways Rebuild

Fast publish… will revisit later



Existing NVGRE gateways manual deployed. Working fine for ages.
NAT resources failed to come online
HyperV Network Virtualization Gateway role failed

FOCM below


Cluster resource xxxxxxxxxxxxxxxxxx of type ‘Nat’ in clustered role ‘HyperV Network Virtualization Gateway’ failed



The Windows NAT Driver service failed to start due to the following error:

The property set specified does not exist on the object



So, I decided I wanted to rebuild my gateways and reconnect them… but how?

Found this KB seemed to have some pertinent info so my voyage of discovery begins here…



So, firstly info gathering:

1) Confirm existing network connections on the gateway service



2) Determine the MAC of the gateway by running the script

Import-Module C:\Scripts\RecoverGatewayScript.psm1
$svcName = "NVGRE_GW01"
$hostCredential = Get-Credential
GetMacAddress $svcName $hostCredential


Enter appropriate credentials and you will get the MAC. In my case: 00155d105701

Stick that in a variable for later using the standard MAC address format

$GWMAC = 00-15-5d-10-57-01


3) Ok, so here’s where we start to get nervous…. Delete the VM’s from VMM. If you created your gateways by a Service, delete the service.

Because I backup everything, I decided to export each VM first just in case. Not sure what having the broken ones restorable will do but you know….

Confirm the VM’s are deployed on the right hosts


Check the VM’s have 3 NIC’s and one is ‘not connected’


Identify the NIC that is planned for NVGRE. It is the NIC that has no connection where 0 is the first NIC in the list. In the example below, my NIC is number 2


get-scvmmserver -computername SCVMM01
$vm = Get-SCVirtualMachine –Name "WINSERVERGW-VM5.Domain.Local"
$vm.VirtualNetworkAdapters | ft Name,VMNetwork,VirtualNetwork




Now, the docco says the grant the MAC address from the pool…. for some reason, the MAC of the NVGRE NIC was outside my MAC pool… I can only assume the VM was not originally deployed from VMM as we know the VM’s were done manually

So.. I powered on anyway…

Before running the below, check your $vm variable is the VM you have chosen to be the primary gateway

Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $vm.VirtualNetworkAdapters[2] –EthernetAddress $GWMAC


Clean up the old records in VMM. Yes do this even if they are the same hosts..

$svcName = "NVGRE-GW01"
$hostCredential = Get-Credential
$gwHosts = @("NVGREHOST1", "NVGREHOST2")
CleanupGatewaysBeforeMigration $svcName $gwHosts $hostCredential

Stuff will happen…. my heart rates also increased (even though this is all non-prod)



Boot up the primary gateway VM

Now build your new connection string:

If you need some inspiration, get the existing connection string with this:

$ns = Get-SCNetworkService -Name $svcName


It should look like this:



Now merge that into the below:

Set-SCNetworkService -NetworkService $ns -ConnectionString "VMHost=HOSTCLUSTER.Domain.Local;GatewayVM=GW-VM-CL02.Domain.Local;BackendSwitch=LSwitch-Hosts;Migrate=true" -Force


Before kicking off, double check the NIC’s in the new gateway VM’s match the names in the Network Service




If you get no immediate PS errors, check VMM jobs



If you’re really impatient.. keep an eye on failover cluster on the gateway


if all goes well, you will have successfully recreated your NVGRE gateways and all resources…



A quick test from external and I was able to access the VM’s on the NVGRE networks sitting behind the gateways.


Crisis averted!


Leave a Reply