[erlang-questions] inet:getifaddrs/0 and windows
Benoit Chesneau
bchesneau@REDACTED
Tue Feb 23 22:51:16 CET 2016
On Tue, Feb 23, 2016 at 9:34 PM Kenneth Lakin <kennethlakin@REDACTED>
wrote:
> On 02/23/2016 12:12 PM, Benoit Chesneau wrote:
> > I'm looking at the result of `inet:getifaddrs/0` and i'm not sure how to
> > use the interface name "//DEVICE/...". Is this a device id? Any idea how
> > i could query it using wmic?
>
> On my machine, the GUID part of the ifname (which is formatted as
> \\DEvICE\TCPIP_$GUID on my Windows 7 system) corresponds to the
> interface with the that GUID in the "SettingID" property of the "wmic
> nicconfig show" spew.
>
> I've never used wmic before, so I don't know how to get the nicconfig
> subcommand to only emit the information for a single interface, but
> maybe you do?
>
>
This command will return the interface with the default gateway in a
parsable way:
```
C:\Users\benoitc> wmic nicconfig get SettingId,DefaultIPGateway /format:csv
Node,DefaultIPGateway,SettingID
DESKTOP-HV04GN1,,{F99FBC41-A2B8-4382-96C2-515CADD46DBF}
DESKTOP-HV04GN1,{192.168.1.254;fe80::224:d4ff:fea6:1b91},{6C201F80-3E4C-4207-9607-2C82ABE771DE}
DESKTOP-HV04GN1,,{D0A5BB3C-75DD-4224-9554-569137405B53}
DESKTOP-HV04GN1,,{58EB28CD-3B79-4A6A-A075-46577E343F83}
````
now I could use the `where INDEX=X` condition if I am sure that
`inet:getifaddrs/0` always return in the same order. Not sure yet how to
filter using the SettingId...
- benoit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160223/b3f973ac/attachment.htm>
More information about the erlang-questions
mailing list