Returns information about the IP route tables configured on a computer.

This script was tested using Python 2.2.2-224 for Microsoft Windows, available from ActiveState.

Python
Edit|Remove
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_IP4RouteTable")
for objItem in colItems:
    print "Age: ", objItem.Age
    print "Caption: ", objItem.Caption
    print "Description: ", objItem.Description
    print "Destination: ", objItem.Destination
    print "Information: ", objItem.Information
    print "Install Date: ", objItem.InstallDate
    print "Interface Index: ", objItem.InterfaceIndex
    print "Mask: ", objItem.Mask
    print "Metric 1: ", objItem.Metric1
    print "Metric 2: ", objItem.Metric2
    print "Metric 3: ", objItem.Metric3
    print "Metric 4: ", objItem.Metric4
    print "Metric 5: ", objItem.Metric5
    print "Name: ", objItem.Name
    print "Next Hop: ", objItem.NextHop
    print "Protocol: ", objItem.Protocol
    print "Status: ", objItem.Status
    print "Type: ", objItem.Type