If a computer has multiple gateways, how can I determine which is the default gateway using the PowerShell?
Use the WMI queries to pull the data that you're looking for. Below is a fairly simple example to pull the default gateway for a device specified in the first line variable. This will query the device for network adapters and display the found information (for each adapter) to the console window - pulls adapter index, adapter description, and default gateway
Shouldn't take much to expand this to process multiple devices, or process based on a list fed via an input file.
$computer = $env:COMPUTERNAME Get-WmiObject win32_networkAdapterConfiguration -ComputerName $computer | Select index,description,defaultipgateway | Format-Table -AutoSize