How do I extract specific interface data from ipconfig?

1.1k views Asked by At

I'm trying to get all data exist in ipconfig /all for a specific interface.

I can not use netssh, or any other program.

I can use grep(for windows - but only grep, not mgrep pcgrep or whatever), sed (same thing..) or findstr of course.

Can you guys think of a way?

I want to get all the data for "SLOT 2 3" and loose all the other data.

This is what the output looks like:

Windows IP Configuration

   Host Name . . . . . . . . . . . . : l-075
   Primary Dns Suffix  . . . . . . . : 
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : wininstall.what.com

Ethernet adapter SLOT 2 3:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::202:c9ff:feb5:94e1%24(Preferred)
   IPv4 Address. . . . . . . . . . . : 12.0.0.33(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Thursday, January 2, 2014 12:26:18 PM
   Lease Expires . . . . . . . . . . : Friday, January 10, 2014 12:26:18 PM
   Default Gateway . . . . . . . . . :
   DHCP Server . . . . . . . . . . . : 12.0.0.83
   DHCPv6 IAID . . . . . . . . . . . : 436208329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-25-9E-19-D4-AE-52-A1-37-E7
   DNS Servers . . . . . . . . . . . : 10.4.0.0
                                       10.4.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter SLOT 2 2:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter #2
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E0
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter NIC4:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #4
   Physical Address. . . . . . . . . : D4-AE-52-A1-37-EA
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

This is what I need:

Ethernet adapter SLOT 2 3:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Ethernet Adapter
   Physical Address. . . . . . . . . : 00-02-C9-B5-94-E1
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::202:c9ff:feb5:94e1%24(Preferred)
   IPv4 Address. . . . . . . . . . . : 12.0.0.33(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.0.0
   Lease Obtained. . . . . . . . . . : Thursday, January 2, 2014 12:26:18 PM
   Lease Expires . . . . . . . . . . : Friday, January 10, 2014 12:26:18 PM
   Default Gateway . . . . . . . . . :
   DHCP Server . . . . . . . . . . . : 12.0.0.83
   DHCPv6 IAID . . . . . . . . . . . : 436208329
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1A-25-9E-19-D4-AE-52-A1-37-E7
   DNS Servers . . . . . . . . . . . : 10.4.0.0
                                       10.4.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled
0

There are 0 answers