Folks-

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:

wmic nicconfig list /format:value
The registry service name is the value labled "SettingID".

In reply to WindowsRegistry{ServiceName} V.S. wmic{ServiceName} UPDATE: Solved by cmv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.