top of page

PowerShell - Get Network Card Metrics

  • Writer: Jon Boyette
    Jon Boyette
  • Feb 10, 2022
  • 1 min read

Save as getlocalmetrics.ps1, once ran this will show the Metrics setting of all IPV4 and IPV6 and if connected or disconnected, used to prioritize Wifi and Ethernet connections

[CmdletBinding()]

param (

[ValidateSet ("IPv4","IPv6")]

[String]$AddressFamily

)

Get-NetIPInterface @PSBoundParameters | Sort-Object InterfaceMetric | ForEach-Object {

if($_.InterfaceAlias -eq 1) { return; }

$adapter= Get-NetAdapter

$address=$_ | Get-NetIPAddress

[PSCustomObject]@{

InterfaceAlias=$_.InterfaceAlias;

InterfaceIndex=$_.InterfaceIndex;

Address="$($address.IPAddress)/$($address.PrefixLength)"

Metric=$_.InterfaceMetric;

Speed=$adapter.LinkSpeed

}

} | ft


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page