Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Select on defaultgateway

$
0
0

Can someone please tell me why this is not working en how to make it work?

The idea is to run a script if a defaultgateway isn't on the list.

# Select on default gateway. If gateway is in skip, no go
$colItems = Get-WmiObject Win32_NetworkAdapterConfiguration -Namespace "root\CIMV2" | where{$_.IPEnabled -eq “True”}
$gw = $colItems.DefaultIPGateway
$skip = ("10.6.0.1","10.5.0.1","192.168.1.1")
if (($skip -contains $gw)-eq $true) {break} else {go}

Regards


Viewing all articles
Browse latest Browse all 6937

Trending Articles