Link to home
Create AccountLog in
Avatar of Suresh Kumar
Suresh Kumar

asked on

output of netstat -r in Powersshell HTML

when you run netstat -r in powershell..it gives the output like this


===========================================================================
Interface List
 11...a4 ba db f5 3a 09 ......Intel(R) 82567LM-3 Gigabit Network Connection
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0    172.24.22.131    172.24.22.180     10
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
    172.24.22.128  255.255.255.128         On-link     172.24.22.180    266
    172.24.22.180  255.255.255.255         On-link     172.24.22.180    266
    172.24.22.255  255.255.255.255         On-link     172.24.22.180    266
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link     172.24.22.180    266
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link     172.24.22.180    266
===========================================================================
Persistent Routes:
  None

IPv6 Route Table
===========================================================================
Active Routes:
 If Metric Network Destination      Gateway
  1    306 ::1/128                  On-link
  1    306 ff00::/8                 On-link
===========================================================================
Persistent Routes:
  None

Need a powershell script to run the netstat-r command and output in the above format in HTML
Avatar of Early Learning Coalition
Early Learning Coalition

netstat-r | out-file "C:\exmpale\netstat.html" won't loog good thought, csv would look better with the columns
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Also, others have gone through this before.  You could use the script here:
https://gallery.technet.microsoft.com/scriptcenter/Get-NetworkStatistics-66057d71
and pipe to ConvertTo-HTML.