    var macAdd = ''
    var i = 0;

    function getMacAddress() 
    {
        var wsh = new ActiveXObject("WScript.Shell");
        var fso = new ActiveXObject("Scripting.FileSystemObject");

        wsh.Run("cmd /C ipconfig /all > c:\\temp.txt", 0);

        var file = fso.OpenTextFile("c:\\temp.txt", 1);
        var currentLine;
        var colon;

        while(file.AtEndOfStream != true)
        {
            currentLine = file.ReadLine();
            if(currentLine.indexOf("Physical Address") >= 0)
            {
                colon = currentLine.indexOf(":");
                macAdd += currentLine.substr(colon + 1);
                i++;
            }
        }
        
        file.Close();
        f = fso.GetFile("c:\\temp.txt");
        f.Delete();
        document.getElementById('txtMACAddress').value = macAdd;
    }
