PowerShell: Check Active Internet Connection

If your machine is connected to the Internet more than once, let’s say cabled and wireless at the same time, which connection is used? Here’s a function that tells you:

function test-ipmetric {
      Get-WmiObject Win32_NetworkAdapter -Filter "AdapterType='Ethernet 802.3'" |
      ForEach-Object { $_.GetRelated('Win32_NetworkAdapterConfiguration') } |
      Select-Object Description, Index, IPEnabled, IPConnectionMetric
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.