Functions attempt #2
This commit is contained in:
parent
713c7462d2
commit
82bcdc77f6
@ -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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user