I'm confusing myself between the service name from the windows registry, and the service name that I get from using wmic. I'm looking for some way to get the registry service name (8BAA28BF-8565-43BE-81C0-E7BBD94187D3) using wmic if possible.
Here is my current code, and example output data:
1.) WindowsRegistry:
$VAR1 = bless( { '/ServiceName' => '{8BAA28BF-8565-43BE-81C0-E7BBD94187D3}', '/Description' => 'Intel(R) PRO/1000 PL Network Connection' }, 'Win32::TieRegistry' );
2.) wmic nic list brief /format:value
$VAR1 = { 'DeviceID' => '2', 'Speed' => undef, 'ServiceName' => 'w39n51', 'NetworkAddresses' => '', 'MACAddress' => '00:13:02:24:B9:4E', 'AdapterType' => 'Ethernet 802.3', 'Name' => 'Intel(R) PRO/Wireless 3945ABG Network Connection' };
Here's my sample script:
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`); shift(@devs); # Remove initial blank line my $d = $devs[1]; # Take the 2nd device my %node = split(/[=\n]/, $d); # Hashify information print Dumper(\%node); my $dev="LMachine/SOFTWARE/Microsoft/Windows NT/CurrentVersion/Network +Cards/2"; my $key=$Registry->Open($dev, { Access => "KEY_READ", Delimiter => "/" + } ); print Dumper($key);
All help is much appreciated!
Thanks
-Craig
UPDATE:
Using the wmic.exe command, you can get the information as follows:
The registry service name is the value labled "SettingID".
For:
Use:
& & < < > > [ [ ] ]