How to get machine serial number?
Hi there, does anyone have any idea how to read the PC's serial number from the BIOS? Any help would be very much appreciated.
Just to clarify, I am talking about the hardware serial number of the PC itself, not (i repeat not) software keys of any description! We are building an asset list of our PCs and this information would help greatly
Many thanks in advance.
GC
Re: How to get machine serial number?
Unscrew case... take off cover (or side depending on age of computer)
Retrieve flashlight from the junk drawer.. make sure flashlight batteries are charged by sticking battery to toungue.. (Warning kids dont try this at home)
Turn on flashlight... point flashlight at a 90 degree angle into pc case.. be carful not to shine in your eyes.
Look on board... for serial number.
LOL
Just joking. I dont know of any software to do it. You could try ASTTRA32 (advanced systemsinfo tool and reporting assistant)
can be downloaded for free @
http://www.astra32.com/download.htm
Try looking in the case as well it should have it in little white letters on the board. everything has a serial number. thats how they keep up with RMA's and such.
By mahine i would guess you mean motherboard/mainboard.
Hope that helped.
Re: How to get machine serial number?
How about setteling for the BIOS name and version?
Add a reference to System.Management as well as an imports statement.
VB Code:
Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim query As New SelectQuery("Win32_bios")
Dim search As New ManagementObjectSearcher(query)
Dim info As ManagementObject
For Each info In search.Get()
Console.Writeline("Bios version: " & info("version").ToString())
Next
End Sub
End Class
Re: How to get machine serial number?
I have added the System.Management reference but don't know what you meant by an import statment, I am sorry, I am really really new to .net and trying to learn as I go along. :(
Thanks in advance
Re: How to get machine serial number?
Damn you techwizz! I was just about to write a sarcastic post like that, you beat me to it:D :lol:
Re: How to get machine serial number?
Quote:
Originally Posted by RobDog888
[color=navy]How about setteling for the BIOS name and version?
Add a reference to System.Management as well as an imports statement.
Hey man, thanks for this, I got it working. Changed out "version" for serialnumber and BINGO! as for the lifting the lid option, it's 160 PCs!!! hehehe thanks though :)
Thanks for your help guys, you are, as always a big bunch of stars!!
GC
Re: How to get machine serial number?
Quote:
Originally Posted by GusChops
Hey man, thanks for this, I got it working. Changed out "version" for serialnumber and BINGO! as for the lifting the lid option, it's 160 PCs!!! hehehe thanks though :)
Thanks for your help guys, you are, as always a big bunch of stars!!
GC
Hi,
Could you post your actual code please?
Re: How to get machine serial number?
Post #3.
Change the line to this...
VB Code:
Console.Writeline("Bios version: " & info("version").ToString())
'Change to this:
Console.Writeline("Bios SN: " & info("serialnumber").ToString())
Re: How to get machine serial number?
Hi,
Sorry to be a pest but that code gives me an error
I am using:
VB Code:
Dim query As New SelectQuery("Win32_bios")
Dim search As New ManagementObjectSearcher(query)
Dim info As ManagementObject
Dim sStr As String
For Each info In search.Get()
sStr = "Bios SN: " & info("serialnumber").ToString()
Next
The error is
Object reference not set to an instance of an object.
on the line
sStr = "Bios SN: " & info("serialnumber").ToString()
I tried amending
Dim info As ManagementObject
to
Dim info As New ManagementObject
but that made no difference.
Re: How to get machine serial number?
I assume that you added the reference and Imports?
Re: How to get machine serial number?
Yes, Both reference & import. You don't get a problem with it? If you don't then I must have something affecting it.
If I replace "SerialNumber" with "Version" it works OK.
Next time I bootup I'll check the BIOS.
Re: How to get machine serial number?
I get "Bios SN: SYS-1234567890"
(notice that the numbers are 1-9+0)
:confused:
Re: How to get machine serial number?
I got "To Be Filled By O.E.M." Running AMI Bios.
Re: How to get machine serial number?
Hahah.. sorry beet you to the punch wossname ... lol
& GusChops.. yeah 160 pc's thats alot of leg work... sorry for the humor. :wave:
Re: How to get machine serial number?
Sorry to refresh an ancient thread, but the code provided by RobDog888 doesn't work in VS2008. SelectQuery, ManagementObjectSearcher and ManagementObject don't exist. The only thing in System.Management is the namespace Instrumentation. Now, what do I do, since I have the same problem as the original author of this thread.
EDIT: Never mind, I fixed it.
Re: How to get machine serial number?
sorry me too like obi1kenobi to revive this old thread....but i am facing a prob. with the same code....i am using vb2003 my code is
Code:
Dim query As New SelectQuery("Win32_bios")
Dim search As New ManagementObjectSearcher(query)
Dim info As ManagementObject
Dim mSrNo As String
For Each info In search.Get()
Console.WriteLine("Bios SN: " & info("serialnumber").ToString())
Next
i just get an output as
Bios SN: System Serial Number
an not the actual serial number....pls. help...i have added the ref. and the import statment..
thankx
Re: How to get machine serial number?
hi guys.....anyone to help me out with this prob pls ?? would b obliged for ur help.
thankx a lot in advance
Re: How to get machine serial number?
Code:
Public Function SystemGUID() As String
Dim sGUID As String = ""
Dim objHDDSearcher As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
For Each hardDrive As System.Management.ManagementObject In objHDDSearcher.Get()
On Error Resume Next
sGUID += hardDrive("SerialNumber").ToString
Next
Return sGUID.Trim
End Function
This is how I generate a system GUID by taking all of the HDD serial numbers. I figured by saying machine serial number you might possibly mean the hard drive serial number and that's how you get it.
Hope this helps.
Re: How to get machine serial number?
Check out the Hardware IDs link in my sig... with that class, you'll be able to get the motherboard Serial #, CPU Serial #, MAC Address of the primary ethernet controller and hard drive Serial #.
Re: How to get machine serial number?
hi jenner thankx for the reply ...
i tried the post ...but it gives me MB-1234567890 but if i give dir in the command prompt and the Volume Serial no. that it shows is diffrent
i would want to display that particular serial no.
Re: How to get machine serial number?
hey hey....thankx a ton jenner....i just read the entier post and got what i wanted....i just posted the reply a bit early....u have really been a help to me..
thankx a lot jenner...