none
how to get unique pc number even we use same ghost image for all pcs? RRS feed

  • Question

  • our application controls instrument and each instrument needs to be calibrated before it can use.

    So we use pc unique number to ensure if an instrument has been calibrated and one calibration data can not be used in other pc/instrument.

    we use the following code to generate pc unique number:

    /// <summary>
            /// Generate an unique number from PC main board serial number
            /// The software will ensure the system calibration by
            /// checking this number.
            /// </summary>
            private string GeneratePCUniqueId()
            {
                string result = string.Empty;
                ManagementObjectCollection mbsList = null;
                ManagementObjectSearcher mbs = new ManagementObjectSearcher("Select * From Win32_BaseBoard");
                mbsList = mbs.Get();
                foreach (ManagementObject mo in mbsList)
                {
                    result += mo["SerialNumber"].ToString();
                }
    
                //create new instance of md5
                MD5 md5 = MD5.Create();
    
                //convert the input text to array of bytes
                byte[] hashData = md5.ComputeHash(Encoding.Default.GetBytes(result));
    
                //create new instance of StringBuilder to save hashed data
                StringBuilder returnValue = new StringBuilder();
    
                //loop for each byte and add it to StringBuilder
                for (int i = 0; i < hashData.Length; i++)
                {
                    returnValue.Append(hashData[i].ToString("X2"));
                }
    
                string id = returnValue.ToString();
                return id;
            }

    we use ghost image to duplicated on all pc to save configuration time.

    we just notice that all PCs with same image get the same unique number with above calculation.

    Is "Win32_BaseBoard" not unique for each PC? thx!

    what calculation do you suggest us to do to get unique pc id even we use the same image? thx! 


    Tuesday, April 30, 2019 6:36 PM

All replies

  • No, it's actually not that common for a motherboard to have a unique, machine-readable serial number.

    You might consider generating a UUID.  Store it in the registry, and if the number isn't there, generate a new one.


    Tim Roberts | Driver MVP Emeritus | Providenza &amp; Boekelheide, Inc.

    Wednesday, May 1, 2019 6:06 AM

  • Hi   Jane Jie Chen,

    Thank you for posting here.

    You can also try to collect more configurations of computer to generate the unique number.
                    
    I have found a useful sample and it generate a key from the Motherboard, Processor, BIOS and so on.

    You can refer the below link:
    Generating Unique Key (Finger Print) for a Computer for Licensing Purposes :

    here’s the results of my test between two different computers.



    Besides, when you use the ghost image on all pc, you need to refresh the hardware information instead of using the same pc information.

    Best Regards

    Yong Lu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 1, 2019 8:30 AM
    Moderator
  • Hi Yong Lu & Tim Roberts,

    thanks to reply our question!

    Yong Lu, 

    you providing the link with info is we are looking for.

    you also mention that "Besides, when you use the ghost image on all pc, you need to refresh the hardware information instead of using the same pc information."

    Do you know how to refresh the hardware information after using the ghost image?

    After refresh hardware information, our calculation of unique pc number may work (I guess).

    We like to try refresh the hardware information solution first.



    Wednesday, May 1, 2019 4:21 PM
  • Hi  Jane Jie Chen,

    >>you also mention that "Besides, when you use the ghost image on all pc, you need to refresh the hardware information instead of using the same pc information."

    Do you know how to refresh the hardware information after using the ghost image?

    After refresh hardware information, our calculation of unique pc number may work (I guess).

    As far as I know, I know the following methods.

    For example(Win 10): 

    1: System Summary:   

          1: windows+r

          2: After entering msinfo32 in the run box, the system information interface will pop up.

          3:  System information is refreshed when the program is loaded.

          4: Subsystem information is also refreshed when you click on each option.

    2: Computer Management:

        

    Besides, if the method above cannot solve your issue. You may should install the system in the normal way (do not use the ghost image).


    Best Regards

    Yong Lu

      

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 2, 2019 7:15 AM
    Moderator