{"id":19783,"date":"2008-12-18T10:00:00","date_gmt":"2008-12-18T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/12\/18\/how-do-i-obtain-the-computer-manufacturers-name\/"},"modified":"2008-12-18T10:00:00","modified_gmt":"2008-12-18T10:00:00","slug":"how-do-i-obtain-the-computer-manufacturers-name","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20081218-00\/?p=19783","title":{"rendered":"How do I obtain the computer manufacturer&#8217;s name?"},"content":{"rendered":"<p><P>\nOne customer wanted a way to determine the name of the\ncomputer manufacturer.\nFor example, they wanted to make some function call and\nget back &#8220;IBM&#8221; or &#8220;Compaq&#8221; or &#8220;Dell&#8221;.\nI don&#8217;t know why they wanted this information,\nand for the moment, I don&#8217;t care.\n<\/P>\n<P>\nAnd of course, when you&#8217;re looking for information,\nyou don&#8217;t search MSDN; that&#8217;s for crazy people.\nNo, let&#8217;s just fire up regedit and hit Ctrl+F.\n(I can&#8217;t imagine how many application compatibility bugs\nwere created by that &#8220;helpful&#8221; Ctrl+F dialog in regedit.)\n<\/P>\n<P>\nThe customer found the registry keys that are used\nto customize the System control panel,\nas well as\n<A HREF=\"http:\/\/support.microsoft.com\/default.aspx?scid=kb;en-us;314472\">\nthe OEMINFO.INI file that also takes part<\/A>.\nBut then the question of reliability arose.\nAfter all, since it&#8217;s just a registry key and an INI file,\nthe user could just edit it and make it say anything they want.\nIf the customer wiped their hard drive and reinstalled Windows\nfrom scratch, then this information would be lost, too.\nThis customer wanted some degree of assurance that if\nthe computer claimed to be a Dell, then it really was a Dell.\n<\/P>\n<P>\nEnter WMI.\n<A HREF=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/sgwho.mspx\">\nThe Scripting Guys<\/A> are all over WMI.\nIf you search for the phrase &#8220;from Win32_ComputerSystem&#8221;\nyou will find hit after hit from the <I>Hey, Scripting Guy!<\/I>\ncolumn.\n<\/P>\n<P>\nAnd it so happens that WMI exposes the computer manufacturer info\nas well.\nIf you look at the scripts that the Scripting Guys put out,\nprobably two thirds of them fall into this pattern:\n<\/P>\n<PRE>\nstrComputer = &#8220;.&#8221;\nSet objWMIService = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\cimv2&#8221;)\nSet colItems = objWMIService.ExecQuery(&#8220;Select * from <FONT COLOR=\"blue\">something<\/FONT>&#8220;)\nFor Each objItem in colItems\n     Wscript.Echo objItem.<FONT COLOR=\"blue\">something<\/FONT>\nNext\n<\/PRE>\n<P>\nAll we have to do is fill in the &#8220;something&#8221;.\n<\/P>\n<PRE>\nstrComputer = &#8220;.&#8221;\nSet objWMIService = GetObject(&#8220;winmgmts:\\\\&#8221; &amp; strComputer &amp; &#8220;\\root\\cimv2&#8221;)\nSet colItems = objWMIService.ExecQuery(&#8220;Select * from <FONT COLOR=\"blue\">Win32_ComputerSystem<\/FONT>&#8220;)\nFor Each objItem in colItems\n     Wscript.Echo <FONT COLOR=\"blue\">&#8220;System Name: &#8221; &amp; objItem.Name<\/FONT>\n     Wscript.Echo <FONT COLOR=\"blue\">&#8220;Manufacturer: &#8221; &amp; objItem.Manufacturer<\/FONT>\n     Wscript.Echo <FONT COLOR=\"blue\">&#8220;Model: &#8221; &amp; objItem.Model<\/FONT>\n     Wscript.Echo\nNext\n<\/PRE>\n<P>\nOkay, so great, we can use WMI to get this information.\nBut how reliable is it?\n<\/P>\n<P>\nWell, the WMI folks tell me that they get the information by\nquerying the\n<A HREF=\"http:\/\/www.dmtf.org\/standards\/smbios\/\">SMBIOS<\/A>\ndirectly, so it&#8217;s as reliable as your BIOS.\nMajor manufacturers will put their names into the BIOS&sup1;,\nbut if you&#8217;re running on a home-built machine, the values\nare whatever came with your motherboard.\nThe BIOS manufacturers typically put placeholder strings into\ntheir SMBIOS, setting the manufacturer to a generic string like\n&#8220;Manufacturer&#8221;, for example.\nWhen the motherboard manufacturer installs the BIOS,\nthey&#8217;re supposed to replace the placeholder strings with\nsomething more meaningful, but most of them don&#8217;t bother.\nThe result is that a machine you put together from parts\nyou bought at the local computer shop will most likely\njust say &#8220;Manufacturer&#8221; for the manufacturer.\n<\/P>\n<P>\nIn summary, if you query WMI for the computer manufacturer\nand it comes back &#8220;Dell&#8221;, then you can be pretty sure you have a Dell.\n(Either that or somebody with way too much time on their hands\nburned a custom BIOS that says &#8220;Dell&#8221;.)\nOn the other hand, if it comes back as &#8220;Manufacturer&#8221; then you&#8217;re\nstill in the dark.\nAll you know is you&#8217;ve got some sort of generic computer.\n<\/P>\n<P>\n&sup1;Even though major manufacturers will put their name\ninto the BIOS,\nI&#8217;m told that if you send your computer back to the manufacturer\nand they replace the motherboard,\nthey will sometimes forget to burn their name into the BIOS of\nthe replacement motherboard.\nAs a result, even on a name-brand computer,\nyou might see &#8220;Manufacturer&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One customer wanted a way to determine the name of the computer manufacturer. For example, they wanted to make some function call and get back &#8220;IBM&#8221; or &#8220;Compaq&#8221; or &#8220;Dell&#8221;. I don&#8217;t know why they wanted this information, and for the moment, I don&#8217;t care. And of course, when you&#8217;re looking for information, you don&#8217;t [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-19783","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>One customer wanted a way to determine the name of the computer manufacturer. For example, they wanted to make some function call and get back &#8220;IBM&#8221; or &#8220;Compaq&#8221; or &#8220;Dell&#8221;. I don&#8217;t know why they wanted this information, and for the moment, I don&#8217;t care. And of course, when you&#8217;re looking for information, you don&#8217;t [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19783","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=19783"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19783\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=19783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=19783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=19783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}