How to get the default gateway from powershell?

后端 未结 5 2222

If a computer has multiple gateways, how can I determine which is the default gateway using the PowerShell?

5条回答
  •  执念已碎
    2020-12-18 05:59

    If you're on PowerShell v3, you can use Get-NetIPConfiguration e.g.:

    Get-NetIPConfiguration | Foreach IPv4DefaultGateway
    

提交回复
热议问题