Getting Windows Server Gateway Functionality with PowerShell in VMM

Window Server Gateway is multi-tenant but still has some limitations that you should keep an eye on. More specifically I am talking about the following limits that are visible when you add the Windows Server Gateway as Network Service in Virtual Machine Manager (SCVMM):

  • Site to Site VPN Connections
  • Routing Domains


These counters are not exposed directly trough VMM’s cmdlets but with simple math you can get these values:

Import-Module virtualmachinemanager
$gateway=Get-SCNetworkGateway -Name NVGREGateway

Write-Output “Occupied Routing Domains: $routingdomainscount”

Write-Output “Routing Domains: $routingdomainscount of $maximumRoutingdomains”
$routingdomainsleft = $maximumRoutingdomains-$numbergateways
Write-Output “$routingdomainsleft available rounting domains left on $gateway”
$vpnconnectionscount = @()
$natconnectionscount = @()
$vpnconnectionscount = 0
$natconnectionscount = 0
foreach ($VMnetwork in $allVMNetworks)

Write-Output “Number of VPN Connections: $vpnconnectionscount”
$maxVPNconnections= $gateway.MaxVPNConnectionSupported
Write-Output “VPN Connections left on $gateway : $vpnconnectionsleft”
Write-Output “VPN Connections: $vpnconnectionscount of $maxVPNconnections”

Write-Output “Number of NATs: $natconnectionscount”
$maxNATconnections= $gateway.MaxRoutingDomainSupported
Write-Output “NATs left on $gateway : $natconnectionsleft”
Write-Output “NATs: $natconnectionscount of $maxNATconnections”


As you can see we can get the routing domains by just simply counting the values in VMNetworkGateways.

VPN connections we can get by getting all VM Networks attached to this Network Gateway, counting the VPN connections for every VM Network and getting their sum.

NAT connections which are not exposed in the UI can be found the same way as VPN Connections. Their maximum value is the number of routing domains as only one NAT connection is allowed per VM Network.

This information can be very useful in capacity planning and automation. I hope it is helpful information.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.