Results 1 to 21 of 21

Thread: How to get machine serial number?

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    10

    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

  2. #2
    Addicted Member techwizz's Avatar
    Join Date
    Apr 2005
    Location
    U.S.A.
    Posts
    246

    Talking 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.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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
    I don't live here any more.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yodaâ„¢
    Posts
    60,710

    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:
    1. Imports System.Management
    2.  
    3. Public Class Form1
    4.  
    5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    6.         Dim query As New SelectQuery("Win32_bios")
    7.         Dim search As New ManagementObjectSearcher(query)
    8.         Dim info As ManagementObject
    9.         For Each info In search.Get()
    10.             Console.Writeline("Bios version: " & info("version").ToString())
    11.         Next
    12.     End Sub
    13. End Class
    VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    • Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    10

    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

  6. #6

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    10

    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

  7. #7
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    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?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yodaâ„¢
    Posts
    60,710

    Re: How to get machine serial number?

    Post #3.
    Change the line to this...

    VB Code:
    1. Console.Writeline("Bios version: " & info("version").ToString())
    2. 'Change to this:
    3. Console.Writeline("Bios SN: " & info("serialnumber").ToString())
    VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    • Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    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:
    1. Dim query As New SelectQuery("Win32_bios")
    2.         Dim search As New ManagementObjectSearcher(query)
    3.         Dim info As ManagementObject
    4.         Dim sStr As String
    5.         For Each info In search.Get()
    6.             sStr = "Bios SN: " & info("serialnumber").ToString()
    7.         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.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yodaâ„¢
    Posts
    60,710

    Re: How to get machine serial number?

    I assume that you added the reference and Imports?
    VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    • Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    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.
    Last edited by taxes; May 7th, 2005 at 03:14 PM.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  12. #12
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622

    Re: How to get machine serial number?

    I get "Bios SN: SYS-1234567890"

    (notice that the numbers are 1-9+0)

    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yodaâ„¢
    Posts
    60,710

    Re: How to get machine serial number?

    I got "To Be Filled By O.E.M." Running AMI Bios.
    VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    • Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14
    Addicted Member techwizz's Avatar
    Join Date
    Apr 2005
    Location
    U.S.A.
    Posts
    246

    Talking 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.

  15. #15
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    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.
    Last edited by obi1kenobi; Mar 16th, 2008 at 05:17 AM.
    Please rate helpful ppl's posts. It's the best 'thank you' you can give

  16. #16
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    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

  17. #17
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    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

  18. #18
    Lively Member
    Join Date
    Apr 2004
    Location
    Philadelphia, PA
    Posts
    120

    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.

  19. #19
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    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 #.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  20. #20
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    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.

  21. #21
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    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...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width