获取本机mac地址

function MacInfo(){
    //访问到WbemScripting对象
    var locator =new ActiveXObject ("WbemScripting.SWbemLocator");
    //访问本地电脑
    var service = locator.ConnectServer(".");
    //获取我们需要的对象的记录集
    var properties = service.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled =True");
    var e =new Enumerator (properties);
        var p = e.item();
        var mac = p.MACAddress;
        return mac;
}

 

posted @ 2020-12-25 09:12  紫花地丁year  阅读(248)  评论(0编辑  收藏  举报