Dirk Kotte
asked on
Need support creating a perl script selecting MAC-Adresses
Hi,
i need ideas (or a script) how to search all MAC Addresses of a windows system and pass these as parameter to an external program...with PERL.
script should do the following:
1. get all MAC-Adresses (LAN1, LAN2, WLAN,...)
= AA-AA-AA-AA-AA-AA , BB-BB-BB-BB-BB-BB , CC-CC-CC-CC-CC-CC-CC
2. start external programm and pass every MAC (one after another) ... possible within a loop
extProg.exe AA-AA-AA-AA-AA-AA
extProg.exe BB-BB-BB-BB-BB-BB
extProg.exe CC-CC-CC-CC-CC-CC-CC
i need ideas (or a script) how to search all MAC Addresses of a windows system and pass these as parameter to an external program...with PERL.
script should do the following:
1. get all MAC-Adresses (LAN1, LAN2, WLAN,...)
= AA-AA-AA-AA-AA-AA , BB-BB-BB-BB-BB-BB , CC-CC-CC-CC-CC-CC-CC
2. start external programm and pass every MAC (one after another) ... possible within a loop
extProg.exe AA-AA-AA-AA-AA-AA
extProg.exe BB-BB-BB-BB-BB-BB
extProg.exe CC-CC-CC-CC-CC-CC-CC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Try this from yesterday to now ... works great and independent from windows version.
thanks.
thanks.
Open in new window
That example uses Write-Output to print the mac addresses, but you can just as easily execute your external command. Just like in Perl, powershell has several ways to execute external connamds.
Another advantage in using the powershell script is that it can find more mac addresses than the getmac command. On my system the getmac command found 2 mac addresses and the powershell script found 3.
Here's what I get from David's script.