I suppose you could read all the subkeys of
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCardsthen match $node{Name} to the first value contained in the "Description" of each subkey entry. Update: Working code that gets the GUID, if it exists:
use strict; use Win32::TieRegistry; use Data::Dumper; # Get nic info via wmic (not available on all versions of windows)... my @devs = split(/^\s*\n/m, `wmic nic list brief /format:value`); my %Regvalues; shift(@devs); # Remove initial blank line DumpReg(); Dumpwmic( $_ )for (0..15); sub Dumpwmic{ my $d = $devs[shift]; # Take the 2nd device my %node = split(/[=\n]/, $d); # Hashify information $node{Name} =~s/\s+$//; print Dumper(\%node); print $Regvalues{ $node{Name} } . "\n"; } sub DumpReg{ my $dev="LMachine/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Netw +orkCards"; my $key=$Registry->Open($dev, { Access => "KEY_READ", Delimiter => +"/" } ); foreach my $subKey ( $key->SubKeyNames ) { $Regvalues{ $key->{$subKey}->{Description} } = $key->{ $subKey +}->{ServiceName}; print "$subKey=" . $key->{$subKey}->{Description} . " " . $key->{ $subKey}->{ServiceName} . "\n"; } }
"As you get older three things happen. The first is your memory goes, and I can't remember the other two... " - Sir Norman Wisdom
In reply to Re^2: WindowsRegistry{ServiceName} V.S. wmic{ServiceName}
by NetWallah
in thread WindowsRegistry{ServiceName} V.S. wmic{ServiceName} UPDATE: Solved
by cmv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |