pcorreya
asked on
api call to get serial number of pc
I believe there is some way to find out the serial number of your computer programatically. Is there some api call available for this ?
ASKER
It is the serial no of the computer which i believe is in the bios
Thanks
Patrick
Thanks
Patrick
The serial number (or assest tag) of the computer is usually available via Windows Management Instrumentation (WMI).
Here is an example (in VB.Net) that demonstrates the concepts:
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace WMISample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_ComputerSystemProduc t")
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("------- ---------- ---------- --------")
Console.WriteLine("Win32_C omputerSys temProduct instance")
Console.WriteLine("------- ---------- ---------- --------")
Console.WriteLine("Caption : {0}", queryObj("Caption"))
Console.WriteLine("Identif yingNumber : {0}", queryObj("IdentifyingNumbe r"))
Console.WriteLine("Name: {0}", queryObj("Name"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace
Here is an example (in VB.Net) that demonstrates the concepts:
Imports System
Imports System.Management
Imports System.Windows.Forms
Namespace WMISample
Public Class MyWMIQuery
Public Overloads Shared Function Main() As Integer
Try
Dim searcher As New ManagementObjectSearcher( _
"root\CIMV2", _
"SELECT * FROM Win32_ComputerSystemProduc
For Each queryObj As ManagementObject in searcher.Get()
Console.WriteLine("-------
Console.WriteLine("Win32_C
Console.WriteLine("-------
Console.WriteLine("Caption
Console.WriteLine("Identif
Console.WriteLine("Name: {0}", queryObj("Name"))
Next
Catch err As ManagementException
MessageBox.Show("An error occurred while querying for WMI data: " & err.Message)
End Try
End Function
End Class
End Namespace
ASKER
How do i make this work in a vb application. Is this is a windows api call ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you looking for Volume's serial number or Mother board's serial no?
bhaspup