Search Unity

Get Motherboard ID

Discussion in 'Scripting' started by KamiKaze425, Mar 29, 2017.

  1. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Hey guys,

    So I know this has been asked, but I'm wondering if anything new has come up since those threads are all about 3+ years old. I'm looking to find a unique Motherboard ID on Windows Standalone builds only.
    This is not for consumer purposes, this is for an arcade type setup. I want them to be able to change components such as drives and GPU, but I want to be locked to the motherboard so they cannot copy the game easily.

    SystemInfo.deviceUniqueIdentifier is quite a bit overkill for my purposes, since even flash drives will change this key. And I don't believe Unity will let me access System.Management in order to get the motherboard ID.

    The alternative I have currently is the MAC address, but that can be spoofed. Also if they have multiple ethernet ports on the motherboard, it can get weird depending on which one the ethernet port is plugged into.

    Any help would be greatly appreciated. Thanks!
     
    ceitel likes this.
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,537
    Have you looked in here for something you can use? Maybe a concatenated mix of multiple values in there?

    Something like deviceUniqueIdentifier, which ironically seems to be exactly what I suggested above.
     
  3. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    I could do a mix of those, but none of those include unique IDs. So if a user builds two identical computers (which is guaranteed in an arcade environment), they would produce the same key.

    Like I said in my initial post, deviceUniqueIdentifier is way overkill and is too strict (flash drives will change the key, so users will never be able to have external drives connected). I also want to allow the replacement of SSD and GPU since those are the most likely pieces to warrant upgrades.
     
    ceitel likes this.
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,537
    Hmm. System.Management has lots of information about that kind of thing, but I don't think it's in Mono.

    Generally mobo's only have 1 Ethernet port and the issue is usually when switching adapters (wired/wireless). For desktops (and corporate workstations) the MAC ID is commonly used as the computer identifier over the network.

    Sounds like you need a username/password solution rather than a computer id solution, tbh. It gives you all of the flexibility without the hardware id concerns.
     
  5. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Yeah, I was hoping for System.Management, unless there is a way to add the references or a plugin that can utilize it.

    There is no guarantee on that. 4 out of 6 computers (dev and test rigs at home and at the office) I use for work have 2 ethernet ports. And if you switch the port you are plugged into, the MAC address will change. Unless I look at both, but then I have to only look at both if there is more than one. Plus, it is pretty easy to change the MAC address.

    We don't want to force the users to always be online if we can help it. We have a whole system planned out for proper usage that will cover most if not all scenarios, but it all revolves around getting a unique ID from the mobo or the CPU. And it has to be properly unique like how the System.Management class can get. Somehow Unity is able to create a hash in their deviceUniqueIdentifier that includes UNIQUE info, but I only want part of it, not all of it.
     
  6. ceitel

    ceitel

    Joined:
    Jan 3, 2017
    Posts:
    35
    @KamiKaze425 Did you ever find a solution to this? I'm in the same boat, currently using deviceUniqueIdentifier and ran into the case where updating Windows caused this value to change. Really hoping for a simple function to get the mobo serial, looking into System.Management but isn't as straightforward as you'd like
     
  7. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What I would do is try running the below command and parse the output with a regex.

    Code (csharp):
    1. wmic baseboard get product,Manufacturer,version,serialnumber
    Or shorten to this:
    Code (csharp):
    1. wmic baseboard get serialnumber
    Below probably works for running the command and capturing the output:
    https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output/4291965
    If not, use powers of googlefu :p

    If this was Linux (and maybe Mac?), I'd run dmidecode instead of wmic.