solutions 1:
ManagementScope theScope = new ManagementScope("\\\\computerName\\root\\cimv2"); StringBuilder theQueryBuilder = new StringBuilder(); theQueryBuilder.Append("SELECT MACAddress FROM Win32_NetworkAdapter"); ObjectQuery theQuery = new ObjectQuery(theQueryBuilder.ToString()); ManagementObjectSearcher theSearcher = new ManagementObjectSearcher(theScope, theQuery); ManagementObjectCollection theCollectionOfResults = theSearcher.Get(); foreach (ManagementObject theCurrentObject in theCollectionOfResults) { string macAdd = "MAC Address: " + theCurrentObject["MACAddress"].ToString(); MessageBox.Show(macAdd); } solutions 2:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Getting MAC Address From Javascript(IE Only)</title> <script language="javascript"> function showMacAddress(){ var obj = new ActiveXObject("WbemScripting.SWbemLocator"); var s = obj.ConnectServer("."); var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); var output; output='<table border="0" cellPadding="5px" cellSpacing="1px" bgColor="#CCCCCC">'; output=output + '<tr bgColor="#EAEAEA"><td>Caption</td><td>MACAddress</td></tr>'; while(!e.atEnd()) { e.moveNext(); var p = e.item (); if(!p) continue; output=output + '<tr bgColor="#FFFFFF">'; output=output + '<td>' + p.Caption; + '</td>'; output=output + '<td>' + p.MACAddress + '</td>'; output=output + '</tr>'; } output=output + '</table>'; document.getElementById("box").innerHTML=output; } </script> </head> <body> <input type="button" value="Show MAC Address" onclick="showMacAddress()" /> <div id="box"> </div> </body> </html>solutions 3:
Advanced JavaScript with Internet Explorer: Retrieving Networking Configuration Information - How to retrieve MAC address and other extended network information using JavaScript Now, let us try to extend the previous sample by showing further information about the network adapters. The entire code for the sample is as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="vs_targetSchema" content="http://schemas. microsoft.com/intellisense/ie5"> <script id="clientEventHandlersJS" language="javascript"> <!-- function Button1_onclick() { var locator = new ActiveXObject "WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); document.write("<table border=1>"); dispHeading(); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("<tr>"); document.write("<td>" + p.Caption + "</td>"); document.write("<td>" + p.IPFilterSecurityEnabled + "</td>"); document.write("<td>" + p.IPPortSecurityEnabled + "</td>"); document.write("<td>" + p.IPXAddress + "</td>"); document.write("<td>" + p.IPXEnabled + "</td>"); document.write("<td>" + p.IPXNetworkNumber + "</td>"); document.write("<td>" + p.MACAddress + "</td>"); document.write("<td>" + p.WINSPrimaryServer + "</td>"); document.write("<td>" + p.WINSSecondaryServer + "</td>"); document.write("</tr>"); } document.write("</table>"); } function dispHeading() { document.write("<thead>"); document.write("<td>Caption</td>"); document.write("<td>IPFilterSecurityEnabled</td>"); document.write("<td>IPPortSecurityEnabled</td>"); document.write("<td>IPXAddress</td>"); document.write("<td>IPXEnabled</td>"); document.write("<td>IPXNetworkNumber</td>"); document.write("<td>MACAddress</td>"); document.write("<td>WINSPrimaryServer</td>"); document.write("<td>WINSSecondaryServer</td>"); document.write("</thead>"); } //--> </script> </head> <body> <INPUT id="Button1" type="button" value="Button" name="Button1" language="javascript" onclick="return Button1_onclick()"> </body> </html> The explanation for the above code is very similar to that of the previous section. The only difference is that I added few more properties to get in-depth network configuration information.
Excellent blog here! Additionally your web site a lot up fast! What web host are you the use of? Can I am getting your affiliate hyperlink in your host? I wish my web site loaded up as quickly as yours lol
naturally like your web-site but you need to take a look at the spelling on several of your posts. Several of them are rife with spelling problems and I find it very troublesome to inform the truth nevertheless I will definitely come back again.
Its such as you learn my mind! You appear to understand a lot approximately this, such as you wrote the ebook in it or something. I believe that you just could do with a few p.c. to drive the message home a bit, however other than that, this is great blog. A fantastic read. I’ll certainly be back.
Really insightful article, I was glad to locate your webblog using the web. I set a hyperlink on my personal site for that reason my followers will probably reach your blog. Don’t hesitate to consider a glimpse.
Kitesurf Tips…
[...]here are some links to websites that we link to because we think they are worth visiting[...]…
Close to being spot on…
Right on the mark, well done….
Enjoyable Reading…
We’re really liking this!…
Consider some changes…
Perhaps you could employ playing devil’s advocate upon occasion….
Websites worth visiting…
[...]here are some links to sites that we link to because we think they are worth visiting[...]……
Fender Guitars…
After research a few of the blog posts on your web site now, and I really like your means of running a blog. I bookmarked it to my bookmark web site list and will be checking back soon. Pls check out my internet website as well and allow me to understa…
WoW Gold…
[...]Here is a superb Weblog You may Uncover Exciting that we Encourage You[...]…
Related……
[...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
Visitor recommendations…
[...]one of our visitors recently recommended the following website[...]……
Best Seller…
Great line up. We will be linking to this great article on our site. Keep up the good writing….
FoxTec Online Computer Parts…
[...]while the sites we suggest below are completely unrelated to ours, we think they are worth a look, so check them out[...]…
Free Backlinks…
I really appreciate this post. I’ve been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thanks again…
Airsoft Guns…
I couldn’t resist commenting…
Nature Herbal World…
Nice post. I was checking continuously this blog and I’m impressed! Very useful information specially the last part
I care for such information a lot. I was seeking this particular info for a long time. Thank you and best of luck….
SEO Company and Web Design…
[...]Cool web sites we visit[...]…
Automotive News and Reviews…
[...]just below, are some interesting sites[...]…
Check this out…
[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate, just click the links over[...]……
Awesome website…
[...]the time to read or visit the content or sites we have linked to below the[...]……
Websites worth visiting…
[...]here are some links to sites that we link to because we think they are worth visiting[...]……
Links…
[...]Sites of interest we have a link to[...]……
Check this out…
[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate, just click the links over[...]……
Visitor recommendations…
[...]one of our visitors recently recommended the following website[...]……
Related……
[...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……
Great website…
[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……
Awesome website…
[...]the time to read or visit the content or sites we have linked to below the[...]……
Great website…
[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……
Sources…
[...]check below, are some totally unrelated websites to ours, however, they are most trustworthy sources that we use[...]……
Cool sites…
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
Links…
[...]Sites of interest we have a link to[...]……
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
Read was interesting, stay in touch……
[...]please visit the sites we follow, including this one, as it represents our picks from the web[...]……
Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
Sites we Like……
[...] Every once in a while we choose blogs that we read. Listed below are the latest sites that we choose [...]……
Sources…
[...]check below, are some totally unrelated websites to ours, however, they are most trustworthy sources that we use[...]……
Awesome website…
[...]the time to read or visit the content or sites we have linked to below the[...]……
Great website…
[...]we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out[...]……
Recent Blogroll Additions……
[...]usually posts some very interesting stuff like this. If you’re new to this site[...]……
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……
Read was interesting, stay in touch……
[...]please visit the sites we follow, including this one, as it represents our picks from the web[...]……