How to get SystemSerialNumber in 64-Bit system?-VBForums
Results 1 to 8 of 8

Thread: How to get SystemSerialNumber in 64-Bit system?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    3

    How to get SystemSerialNumber in 64-Bit system?

    Hello, i've used this code to get the System serial number in a W7 32 bits and works perfectly, but this doesn't work in 64Bits.


    Private Function SystemSerialNumber32() As String
    Dim mother_boards As Variant
    Dim board As Variant
    Dim wmi As Variant
    Dim serial_numbers As String

    ' Get the Windows Management Instrumentation object.
    Set wmi = GetObject("WinMgmts:")

    ' Get the "base boards" (mother boards).
    Set mother_boards = wmi.instancesof("Win32_BaseBoard")
    For Each board In mother_boards
    serial_numbers = serial_numbers & ", " & _
    board.SerialNumber
    Next board
    If Len(serial_numbers) > 0 Then serial_numbers = _
    mid$(serial_numbers, 3)

    SystemSerialNumber32 = serial_numbers
    End Function

    I've tried changing "Win32_BaseBoard" to "Win64_BaseBoard" and doesn't work

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    11,629

    Re: How to get SystemSerialNumber in 64-Bit system?

    To the best of my knowledge this only works on some boards

  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    5,785

    Re: How to get SystemSerialNumber in 64-Bit system?

    Found this link:

    https://www.experts-exchange.com/que...wer14058794-20

    Returns a negative number for mine, so not sure if it works correctly or not.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    3

    Re: How to get SystemSerialNumber in 64-Bit system?

    Quote Originally Posted by DataMiser View Post
    To the best of my knowledge this only works on some boards
    Yeah, ik that, but I need a software unique ID

    Quote Originally Posted by SamOscarBrown View Post
    Found this link,

    https://www.experts-exchange.com/que...wer14058794-20

    Returns a negative number for mine, so not sure if it works correctly or not.
    Thanks Sam, i'll check in a 64bit system.

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,325

    Re: How to get SystemSerialNumber in 64-Bit system?

    The WMI Service is an admin scripting tool and is not meant to be used in real applications. It may be disabled or secured which could result in your programs crashing anyway.

    In any case most of what it can return about the local system can be obtained far more directly.

    I have attached a Project with a very stripped down version of the more complete SMBIOS query Class I posted to the CodeBank: [VB6] Read SMBIOS info w/o WMI.

    This minimal version only retrieves the serial number (if available at all).

    Seems to run just fine on both 32- and 64-bit Windows PCs. I tested three, one has no serial number (64-bit) and the other two (32-bit and 64-bit) do.
    Attached Files Attached Files

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2017
    Posts
    3

    Re: How to get SystemSerialNumber in 64-Bit system?

    Hi dilettante, I'm looking for a UniqueID in a 64bit Windows.
    In a 32bit Windows I've using SystemSerialNumber, but I can't get anything from 64bit system.

    Sorry for my english, is bad.

    Thanks for helping me guys

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,325

    Re: How to get SystemSerialNumber in 64-Bit system?

    Some PCs simply don't have one. It has nothing to do with what OS is installed.

    The best thing you can do is grab a lot of things that might be unique and combine them. PCs do not have unique IDs, and when Intel tried adding one to their CPUs there was a huge uproar over it and so they disabled the feature.

    Some people will grab the first network adapter's MAC address, but that can be changed by users. Some will try to grab the system drive's physical serial number, but people replace drives. Some will fish out the Windows Product Key value.

    But you almost have to grab several items and hash them together.

  8. #8
    Hyperactive Member
    Join Date
    Jan 2013
    Posts
    290

    Re: How to get SystemSerialNumber in 64-Bit system?

    Quote Originally Posted by dilettante View Post
    Some PCs simply don't have one. It has nothing to do with what OS is installed.

    The best thing you can do is grab a lot of things that might be unique and combine them. PCs do not have unique IDs, and when Intel tried adding one to their CPUs there was a huge uproar over it and so they disabled the feature.

    Some people will grab the first network adapter's MAC address, but that can be changed by users. Some will try to grab the system drive's physical serial number, but people replace drives. Some will fish out the Windows Product Key value.

    But you almost have to grab several items and hash them together.
    Well, you can grab the HDD/SSD serial with WMI query.

    hey, cpu serial number is not' enable/disabled in BIOS configuration?

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.