Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript PHP
How to find MAC address of client computer
Posted 15-Feb-13 22:29pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Is it assignment of the day? I did replied the exact same question few hours back. You guys don't look before posting!D'Oh! | :doh:
how to get the mac address of my pc in php[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It depends on security level page runs on. If you are running script using some elevated privileges, on a windows machine, one of code snippets below below could work
 
for (var arr = [], enum_ = new Enumerator(GetObject('WinMgmts:\\\\.\\Root\\CIMV2').ExecQuery('SELECT * FROM Win32_NetworkAdapter', 'WQL', 0x10 | 0x20)); !enum_.atEnd(); enum_.moveNext()) {
    var mac = enum_.item().MACAddress;
    mac && arr.push(mac);
}
WScript.Echo(arr.join('\n'));
 

 
var arr = [], WScriptExec = WScript.CreateObject('WScript.Shell').Exec('ipconfig /all');
while (!WScriptExec.status) WScript.Sleep(100);
WScript.Echo(WScriptExec.StdOut.ReadAll().match(/(?:[\da-f]{2}\-){5}[\da-f]{2}/gi).join('\n'));
 

From the web page, unless you use some undocumented feature or specific component, it would not be possible to get the MAC address.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 464
1 Sergey Alexandrovich Kryukov 429
2 Maciej Los 285
3 CPallini 180
4 Peter Leow 170
0 Sergey Alexandrovich Kryukov 6,971
1 OriginalGriff 5,532
2 Peter Leow 3,997
3 Mika Wendelius 2,850
4 CHill60 2,808


Advertise | Privacy | Mobile
Web04 | 2.8.150224.1 | Last Updated 16 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100