Solved

serial number of harddisk

Posted on 2007-11-28
3
881 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is an explanation of a simple data model to help parse a JSON feed
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

789 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