Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to find MAC address of client computer
Posted

Is it assignment of the day? I did replied the exact same question few hours back. You guys don't look before posting!:doh:
how to get the mac address of my pc in php[^]
 
Share this answer
 
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

JavaScript
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'));




JavaScript
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900