{"id":765,"date":"2012-06-28T23:57:05","date_gmt":"2012-06-28T13:57:05","guid":{"rendered":"http:\/\/ntsblog.homedev.com.au\/?p=765"},"modified":"2013-01-24T00:33:34","modified_gmt":"2013-01-23T13:33:34","slug":"unique-computer-identifier","status":"publish","type":"post","link":"https:\/\/ntsblog.homedev.com.au\/index.php\/2012\/06\/28\/unique-computer-identifier\/","title":{"rendered":"What is the best unique computer identifier?"},"content":{"rendered":"<div id=\"ntsbl-1475675597\" class=\"ntsbl-before-content ntsbl-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-6288941070289539\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:728px;height:90px;\" \ndata-ad-client=\"ca-pub-6288941070289539\" \ndata-ad-slot=\"9356781486\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><p>I have been trying to find out what is the best way to uniquely identify a computer for licensing purposes.<\/p>\n<p>Here are some suggestions.<\/p>\n<h2>Computer SID<\/h2>\n<p>In a previous post <a href=\"https:\/\/ntsblog.homedev.com.au\/index.php\/2012\/06\/26\/read-computer-sid-64-bit-machine\/\">&#8220;Read computer sid on 64-bit machine<\/a>&#8221; I show how to get the Product ID of the operating system as the unique identifier.<\/p>\n<p><b>Cons<\/b><br \/>\nThis seemed great and I even used it for a licensing tool until I installed the software on multiple virtual machines!<br \/>\nThe VM&#8217;s were cloned from the same base image and guess what? They all had the same Product ID, which meant that every computer passed in the same ID.<\/p>\n<h2>Network Card Mac address and other hardware items<\/h2>\n<p>These do provide a level of uniqueness but there are a few problems:<\/p>\n<p><b>Cons<\/b><\/p>\n<ol>\n<li>Most computers these days have many network cards, USB wi-fi etc, so which card do you choose to get the MAC address from?\n<li>Unless it&#8217;s in a laptop or onboard, NIC&#8217;s can easily be replaced.\n<\/ol>\n<h2>What is the best unique computer identifier<\/h2>\n<p>Thinking logically you want to use an identifier that is likely to change the least so CPU&#8217;s, NIC&#8217;s, Hard Drives etc etc should all be rejected.<\/p>\n<p>The one component that generally doesn&#8217;t change very often is the motherboard. The motherboard has a UUID (Univerally Unique Identifier), that can be read from the bios.<\/p>\n<p>This value is unique in both physical computers and Virtual Machines.<\/p>\n<p>The following code sample is a c# example of how to read the UUID from the motherboard BIOS using the System.Management.ManagementClass to read the Win32_ComputerSystemProduct<\/p>\n<p>[csharp]<br \/>\nusing System.Management;<br \/>\n&#8230;<br \/>\n&#8230;<br \/>\npublic static string UUID<br \/>\n{<br \/>\n    get<br \/>\n    {<br \/>\n        string uuid = string.Empty;<\/p>\n<p>        ManagementClass mc = new ManagementClass(&quot;Win32_ComputerSystemProduct&quot;);<br \/>\n        ManagementObjectCollection moc = mc.GetInstances();<\/p>\n<p>        foreach (ManagementObject mo in moc)<br \/>\n        {<br \/>\n            uuid = mo.Properties[&quot;UUID&quot;].Value.ToString();<br \/>\n            break;<br \/>\n        }<\/p>\n<p>        return uuid;<br \/>\n    }<br \/>\n}<br \/>\n[\/csharp]<\/p>\n<p>Note for a full reference of all the Win32 Management classes go here:<br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa394084%28v=vs.85%29.aspx\" target=\"_blank\">MSDN Win32 Classes<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been trying to find out what is the best way to uniquely identify a computer for licensing purposes. Here are some suggestions. Computer [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-765","post","type-post","status-publish","format-standard","hentry","category-c","category-code"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=765"}],"version-history":[{"count":0,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/765\/revisions"}],"wp:attachment":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}