Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Ospalý <[email protected]>
  • Loading branch information
Petr Ospalý committed May 25, 2020
1 parent 15eee3d commit e2a3ea0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function configureNetwork($context) {
$ip6PrefixKey = $nicPrefix + "IP6_PREFIX_LENGTH"
$gw6Key = $nicPrefix + "GATEWAY6"
$mtuKey = $nicPrefix + "MTU"
$metricKey = $nicPrefix + "METRIC"

$ip = $context[$ipKey]
$netmask = $context[$netmaskKey]
Expand All @@ -197,6 +198,7 @@ function configureNetwork($context) {
$gateway = $context[$gatewayKey]
$network = $context[$networkKey]
$mtu = $context[$mtuKey]
$metric = $context[$metricKey]

$ip6 = $context[$ip6Key]
$ip6ULA = $context[$ip6ULAKey]
Expand Down Expand Up @@ -276,8 +278,13 @@ function configureNetwork($context) {
if ($gateway) {

# Set the Gateway
Write-Output "- Set Gateway"
$ret = $nic.SetGateways($gateway)
if ($metric) {
Write-Output "- Set Gateway with metric"
$ret = $nic.SetGateways($gateway, $metric)
} Else {
Write-Output "- Set Gateway"
$ret = $nic.SetGateways($gateway)
}
If ($ret.ReturnValue) {
Write-Output (" ... Failed: " + $ret.ReturnValue.ToString())
} Else {
Expand Down

0 comments on commit e2a3ea0

Please sign in to comment.