{"id":34,"date":"2006-01-23T16:20:00","date_gmt":"2006-01-23T15:20:00","guid":{"rendered":"https:\/\/iddlesblog.wordpress.com\/2006\/01\/23\/windows-automated-installations-what-to-call-workstations\/"},"modified":"2006-01-23T16:20:00","modified_gmt":"2006-01-23T15:20:00","slug":"windows-automated-installations-what-to-call-workstations","status":"publish","type":"post","link":"https:\/\/iddles.co.uk\/index.php\/2006\/01\/23\/windows-automated-installations-what-to-call-workstations\/","title":{"rendered":"Windows Automated Installations &#8211; What to call workstations"},"content":{"rendered":"<p>One of the big problems I have found when creating build systems for companies is what to call machines when they are being built.<br \/>\nA good idea a few companies I have worked at is to use the vendor serial number that is affixed and labeled all over the machines.\u00a0 On Dell machines its called the &#8216;Service Tag Number&#8217;<br \/>\nHow to pipe that into installations is another story but if you are doing simple cloning using Ghost, PQ or Altris then this handy VBscript may come in useful.\u00a0 It extracts the Dell Tag number using WMI and then sets a SYSTEM environment varible called <strong>DellTag<\/strong><br \/>\nBTW &#8211; I&#8217;m not a hardcore coder so if anyone can make it better then please advise!\u00a0\u00a0Fragments were made using the excellent Microsoft Scriptomatic2 tool.<br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">&#8216; DellSN.vbs<br \/>\n&#8216;<br \/>\n&#8216; Version 1.0 &#8211; Kevin Iddles, Yawns.com Limited<br \/>\n&#8216;<br \/>\n&#8216; Script to extract Dell Tag Number from BIOS using WMI<br \/>\n&#8216; Outputs Dell tag to screen and sets a SYSTEM environment varible accordingly.<br \/>\n&#8216;<br \/>\n&#8216; Call from CMD by using &#8212;-\u00a0 cscript \/\/NoLogo DellSn.vbs<br \/>\n&#8216; Obviously will need to open a new session to pickup the setting<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">&#8216;On Error Resume Next<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">Const wbemFlagReturnImmediately = &amp;h10<br \/>\nConst wbemFlagForwardOnly = &amp;h20<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">Dim strSN<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">&#8216; Start Get the Dell Asset number from BIOS<br \/>\n\u00a0\u00a0 Set objWMIService = GetObject(&#8220;winmgmts:\\.rootCIMV2&#8221;)<br \/>\n\u00a0\u00a0 Set colItems = objWMIService.ExecQuery(&#8220;SELECT SerialNumber FROM Win32_BIOS&#8221;, &#8220;WQL&#8221;, wbemFlagReturnImmediately + wbemFlagForwardOnly)<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">\u00a0\u00a0 For Each objItem In colItems<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 WScript.Echo objItem.SerialNumber<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0 strSN = objItem.SerialNumber<br \/>\n\u00a0\u00a0 Next<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">&#8216; Debug &#8211; Echo results set in var<br \/>\n&#8216; Wscript.Echo strSN<\/span><br \/>\n<span style=\"font-family:Courier New;font-size:x-small;\">&#8216; Start Set Env<br \/>\n&#8216;<br \/>\n&#8216; This gets set as a SYSTEM varible &#8211; user must be a local administrator for correct permissions<br \/>\n\u00a0 Set EnvClass = GetObject(&#8220;WinMgmts:\\.rootcimv2:Win32_Environment&#8221;)<br \/>\n\u00a0 &#8216; Make a new instance of that class<br \/>\n\u00a0 Set EnvVarInst = EnvClass.SpawnInstance_<br \/>\n\u00a0 &#8216; File in the key props and props of interest on that instance<br \/>\n\u00a0 EnvVarInst.UserName = &#8220;&lt;SYSTEM&gt;&#8221;<br \/>\n\u00a0 EnvVarInst.Name = &#8220;DellTag&#8221;<br \/>\n\u00a0 EnvVarInst.VariableValue = strSN<br \/>\n\u00a0 &#8216; Write the new instance in to WMI<br \/>\n\u00a0 EnvVarInst.Put_<br \/>\n&#8216; End Set Env<\/span><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/iddles.co.uk\/aggbug.aspx?PostID=931\" alt=\"\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the big problems I have found when creating build systems for companies is what to call machines when they are being built. A good idea a few companies I have worked at is to use the vendor serial number that is affixed and labeled all over the machines.\u00a0 On Dell machines its called [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[17],"tags":[21],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-windows","tag-automated-install","post-preview"],"_links":{"self":[{"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":0,"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"wp:attachment":[{"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iddles.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}