You can access WMI via Perl pretty much the same way you would any other 
automation object. I haven't used it to enumerate the NICs the way you want to 
do, but a quick and dirty example of using WMI in Perl is one I wrote to 
enumerate drives. You can probably use the windows scripting help to find the 
objects for the NICs.

An example of using Perl with WMI:

#!perl

use Win32;
use Win32::OLE qw( in );
*error = *Win32::OLE::LastError;

my $wmi = Win32::OLE->GetObject("Winmgmts:");
die error() if error();

our $drives = $wmi->ExecQuery("Select * from Win32_LogicalDisk");
die error() if error();

foreach my $drive (in( $drives ))
{
               print "drive name: $drive->{Name}\n";
               print "filesystem: $drive->{FileSystem}\n";
               print "Drive size: $drive->{Size}\n";
               print "Drive freespace: $drive->{FreeSpace}\n";
               print "Drive type: $drive->{DriveType}\n";
               print "\n\n";
}


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ankit Mehrotra
Sent: Monday, August 27, 2007 2:48 AM
To: Foo JH
Cc: perl-win32-users@listserv.ActiveState.com; [EMAIL PROTECTED]
Subject: Re: reading the Network Interface Card(NIC) name


I am not very well versed in wmi. Is there some other means of doing it 
preferably using perl !!

Ankit

Foo JH <[EMAIL PROTECTED]>

08/27/2007 12:37 PM

To

Ankit Mehrotra <[EMAIL PROTECTED]>

cc

perl-win32-users@listserv.ActiveState.com, [EMAIL PROTECTED]

Subject

Re: reading the Network Interface Card(NIC) name







If you're doing this via Windows, you can go via WMI.

Google: wmi win32_networkadapter

Ankit Mehrotra wrote:
>
> Hi all,
>
> I want to read the names of the NIC's of a  blade server. Is there any
> ready made package through which I can read them ?
>
> Thanks
> Ankit
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

ForwardSourceID:NT00013B6E

=====-----=====-----=====

Notice: The information contained in this e-mail

message and/or attachments to it may contain

confidential or privileged information. If you are

not the intended recipient, any dissemination, use,

review, distribution, printing or copying of the

information contained in this e-mail message

and/or attachments to it are strictly prohibited. If

you have received this communication in error,

please notify us by reply e-mail or telephone and

immediately and permanently delete the message

and any attachments. Thank you




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to