diff --git a/scripts/ps/netcheck.ps1 b/scripts/ps/netcheck.ps1 index cebc5eb..e477d22 100644 --- a/scripts/ps/netcheck.ps1 +++ b/scripts/ps/netcheck.ps1 @@ -1,8 +1,9 @@ -function fDefaultGatewayCheck { +Function fDefaultGatewayCheck { Write-Host "---Determine Default Gateway---" 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() Test-Connection $vSCNextHop if ($? -eq $false) { @@ -31,6 +32,6 @@ Test-Connection $vSCNextHop } else { - fDefaultGatewayCheck + fDefaultGatewayCheck() } }