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

image

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

$routingdomainscount=$gateway.VMNetworkGateways.Count
Write-Output “Occupied Routing Domains: $routingdomainscount”

$maximumRoutingdomains=$gateway.MaxRoutingDomainSupported
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
$allVMNetworks=$gateway.VMNetworkGateways
foreach ($VMnetwork in $allVMNetworks)
{

$VMnetworkVpn=$VMNetwork.VPNConnections.Count
$VMNetworkNAT=$VMNetwork.NATConnections.Count
$vpnconnectionscount+=$VMnetworkVpn
$natconnectionscount+=$VMNetworkNAT
}
Write-Output “Number of VPN Connections: $vpnconnectionscount”
$maxVPNconnections= $gateway.MaxVPNConnectionSupported
$vpnconnectionsleft=$maxVPNconnections-$vpnconnectionscount
Write-Output “VPN Connections left on $gateway : $vpnconnectionsleft”
Write-Output “VPN Connections: $vpnconnectionscount of $maxVPNconnections”

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

image

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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s