The WMI class you'd probably want to talk to is
Win32_NetworkAdapterConfiguration

Change this line:

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

To read: 

our $drives = $wmi->ExecQuery("Select * from
Win32_NetworkAdapterConfiguration where IPEnabled = 1");

And then use this documentation (below) to get this script (in the
thread) pulling all of the correct properties..

http://msdn2.microsoft.com/en-us/library/aa394217.aspx

Or 

Download this script:

http://www.roth.net/perl/scripts/scripts.asp?wmi-Generic.pl

And run it like so...

perl wmi-generic.pl computername Win32_NetworkAdapterConfiguration

My script won't do the "where ipenabled = 1" (in it's current
incantation).

But that would help you figure out all the properties that are exposed
and how they read in your specific environment.

I have a version that allows for where clauses (but I just haven't
uploaded it to Mr Roth's site).

Steven
________________________________

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

        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