iRemix94 has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow perl users,
I currently try to find a way to get information about my local network interfaces. To be more precise, I want to know which one of my network interfaces is a real (physical) or a virtual one. I don't had my eyes on the Net::Interface module, but apparently my ppm won't find the package at all. Additionally, I don't really know if the Net::Interface module can distinguish between physical and virtual network interfaces. Is there a way to get the information without the usage of that package?
Edit: For anyone interested, I found a solution:
my $dbh = DBI->connect('dbi:WMI:'); my $stmt = " SELECT Name, NetConnectionID FROM Win32_NetworkAdapter WHERE Manufacturer != 'Microsoft' AND NOT PNPDeviceID LIKE 'ROOT\\\\%' "; my $sth = $dbh->prepare($stmt); $sth->execute(); while (my @row = $sth->fetchrow_array) { print "Name:\t\t\t$row[0]\Interface:\t$row[1]\n\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trying to get information about network interfaces
by haukex (Archbishop) on Jun 10, 2016 at 14:24 UTC | |
by iRemix94 (Sexton) on Jun 10, 2016 at 19:56 UTC | |
|
Re: Trying to get information about network interfaces
by Mr. Muskrat (Canon) on Jun 10, 2016 at 20:31 UTC | |
|
Re: Trying to get information about network interfaces
by stevieb (Canon) on Jun 10, 2016 at 14:15 UTC | |
by iRemix94 (Sexton) on Jun 10, 2016 at 19:55 UTC | |
by Anonymous Monk on Jun 14, 2016 at 06:22 UTC |