Returns information about persisted IP4 routes on a computer. Persistent entries are automatically reinserted in the route table each time the route table is rebuilt. This class is only applicable to IP4 and does not address IPX or IP6. This script requires both Windows PowerShell and the corresponding version of the .NET Framework. For more information on downloading these items see the Windows PowerShell download page (right).

PowerShell
Edit|Remove
$strComputer = "."

$colItems = get-wmiobject -class "Win32_IP4PersistedRouteTable" -namespace "root\CIMV2" `
-computername $strComputer

foreach ($objItem in $colItems) {
      write-host "Caption: " $objItem.Caption
      write-host "Description: " $objItem.Description
      write-host "Destination: " $objItem.Destination
      write-host "Installation Date: " $objItem.InstallDate
      write-host "Mask: " $objItem.Mask
      write-host "Metric 1: " $objItem.Metric1
      write-host "Name: " $objItem.Name
      write-host "Next Hop: " $objItem.NextHop
      write-host "Status: " $objItem.Status
      write-host
}