Solved

serial number of harddisk

Posted on 2007-11-28
3
882 Views
Last Modified: 2013-11-26
how can we get serial number of harddisk in vb.net 2005 and computer id or a mac address
0
Comment
Question by:16700
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20370025
Consider that a computer can have more than one harddisk or mac address.
For MAC address, you can retrieve the list of MACs this way:

           List<string> Nics = new List<string>();

            NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface nic in adapters)
            {
                NetworkInterfaceType type= nic.NetworkInterfaceType;
                if (type!= NetworkInterfaceType.Loopback && type!= NetworkInterfaceType.Tunnel && type!= NetworkInterfaceType.Unknown)
                {
                    this.Nics.Add(nic.GetPhysicalAddress().ToString());
                }
            }
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 20370079
Sorry, that was C# code. Here is the vb.net code:

Dim Nics As New List(Of String)()

Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
For Each nic As NetworkInterface In adapters
    Dim type As NetworkInterfaceType = nic.NetworkInterfaceType
    If type <> NetworkInterfaceType.Loopback AndAlso type <> NetworkInterfaceType.Tunnel AndAlso type <> NetworkInterfaceType.Unknown Then
        Me.Nics.Add(nic.GetPhysicalAddress().ToString())
    End If
Next

you will need also:

Imports System.Net
Imports System.Net.NetworkInformation

0
 

Author Closing Comment

by:16700
ID: 31411561
Thankx.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding a countdown to HTA 12 99
Crashing when deleting value with no child in Binary Tree 4 32
Java Inheritance super keyword use 8 39
Web page design problem 3 18
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question