Function attempt

This commit is contained in:
camoy 2024-08-15 18:31:07 -07:00
parent 82bcdc77f6
commit dc30a0bb61

@ -3,7 +3,7 @@ Function fDefaultGatewayCheck {
Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object nexthop, metric1, interfaceindex
$vSCNextHop = (Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '0.0.0.0' -and $_.mask -eq '0.0.0.0' } | Sort-Object metric1 | select nexthop | Format-Wide | Out-String).trim()
}
fDefaultGatewayCheck()
fDefaultGatewayCheck
Test-Connection $vSCNextHop
if ($? -eq $false)
{
@ -32,6 +32,6 @@ Test-Connection $vSCNextHop
}
else
{
fDefaultGatewayCheck()
fDefaultGatewayCheck
}
}