Your example is how I would expect it to work. However, in you example $route.destination =
Address
-------
default
$route.destination will never be equal to "default" and your expression will never be true.
Instead you have to use "$route.destination.address"
My goal was to create a script to get the default gateway/route of a particular controller:
$routelist = get-nanetroute
foreach ($route in $routelist) {
$var = $route.destination.address
if ($var -eq "default") {
$gateway = $route.destination.address
write-host "The Default Route is $gateway"
}
}
It makes sense, but why not just put the values in the "destination" and "gateway" properties respectively...