Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

serial number of harddisk

Posted on 2007-11-28
3
Medium Priority
?
889 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 2000 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

705 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