Created
October 4, 2024 00:42
-
-
Save Jaid/0da15d0c1038531346a2d25d5f25a94d to your computer and use it in GitHub Desktop.
Revisions
-
Jaid created this gist
Oct 4, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ (Get-NetIPAddress -AddressFamily IPv4 -InterfaceIndex (Get-NetRoute -DestinationPrefix '0.0.0.0/0' | Where-Object { (Get-NetAdapter -InterfaceIndex $_.InterfaceIndex).InterfaceType -eq 6 } | Sort-Object Metric | Select-Object -First 1).InterfaceIndex | Where-Object { $_.IPAddress -notlike '127.*' }).IPAddress