CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Win32 Programming Help:
"Win32_NetworkAdapter"

 



Bode
Novice

Aug 8, 2002, 7:15 AM

Post #1 of 2 (4570 views)
"Win32_NetworkAdapter" Can't Post

I want to get the MAC address. The problem is it returns the correct MAC address that i want i.e 00:04:76:DC:D6:EC but it also returns another (when the foreach loops again) 50:50:54:50:30:30. I only want the first one. Does anyone know what this second part is ?

I tryed to get round it by putting this $varible in to an array. However when i do this it adds both strings to element[0].

Is there a way to write the code below so it is not in a loop ? Or any other way to get round this problem?

Heres my code snippet. Im trying to gather system information.

#Get MAC Address
foreach $Object (in ($WMIServices->InstancesOf( "Win32_NetworkAdapter" ) ) ) {
$MAC = ($Object->{MACAddress});
print" $MAC";
}


Cheers for any hints, tips, or explanations.


thebitch
User

Aug 9, 2002, 7:51 AM

Post #2 of 2 (4567 views)
Re: [Bode] "Win32_NetworkAdapter" [In reply to] Can't Post

can i see the rest of your code (looks intersting)?
How do you create $WMIServices ... what module are you using?
Please share

now as to your question,
on my win2000 i got at least 10 network adapters,
and I suppose most people have at least 2.
I don't see this as a problem
( the first adapter in the list is probably the current in use)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives