{"id":521,"date":"2011-06-12T16:52:00","date_gmt":"2011-06-12T16:52:00","guid":{"rendered":"https:\/\/www.geekmungus.co.uk\/?p=521"},"modified":"2022-11-05T10:53:43","modified_gmt":"2022-11-05T10:53:43","slug":"wsus-computers-reporting-and-then-disappearing","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=521","title":{"rendered":"WSUS &#8211; Computers reporting and then disappearing"},"content":{"rendered":"\n<p>Reset WSUS ClientBeen working on WSUS and have setup a WSUS server. However started to get a problem whereby the computers were appearing on WSUS and reporting their status then disappearing. I noticed that they were disappearing and being replaced by another computer.<\/p>\n\n\n\n<p>It turns out that when a machine is ghosted and then sysprep&#8217;ed it doesnt reset the WSUS id, which is a unique ID that WSUS uses to track the computer. So i&#8217;ve been able to come up with a script that can be run manually or via a script (GPO) on startup to reset this ID and make it talk properly to WSUS. Note this also sorted problems with Virtual Machines that have been cloned too.<\/p>\n\n\n\n<p>Set oShell = CreateObject(&#8220;WScript.Shell&#8221;)<\/p>\n\n\n\n<p>sRegKey = &#8220;HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate&#8221;<\/p>\n\n\n\n<p>pRegKey = &#8220;HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections&#8221;<\/p>\n\n\n\n<p>&#8216; suppress error in case values does not exist<\/p>\n\n\n\n<p>On Error Resume Next<\/p>\n\n\n\n<p>&#8216; check for marker<\/p>\n\n\n\n<p>sIDDeleted = oShell.RegRead( sRegKey &amp; &#8220;\\IDDeleted&#8221;)<\/p>\n\n\n\n<p>&#8216; to be sure values is only deleted once, test on marker<\/p>\n\n\n\n<p>If sIDDeleted &lt;&gt; &#8220;yes&#8221; Then<\/p>\n\n\n\n<p>&#8216; delete any WinHttpSettings registry entry (interferes with WSUS)<\/p>\n\n\n\n<p>oshell.RegDelete pRegKey &amp; &#8220;\\WinHttpSettings&#8221;<\/p>\n\n\n\n<p>&#8216; delete values<\/p>\n\n\n\n<p>oShell.RegDelete sRegKey &amp; &#8220;\\AccountDomainSid&#8221;<\/p>\n\n\n\n<p>oShell.RegDelete sRegKey &amp; &#8220;\\PingID&#8221;<\/p>\n\n\n\n<p>oShell.RegDelete sRegKey &amp; &#8220;\\SusClientId&#8221;<\/p>\n\n\n\n<p>&#8216; Stop and start the Automatic updates service<\/p>\n\n\n\n<p>oShell.Run &#8220;%SystemRoot%\\system32\\net.exe stop wuauserv&#8221;, 0, True<\/p>\n\n\n\n<p>oShell.Run &#8220;%SystemRoot%\\system32\\net.exe start wuauserv&#8221;, 0, True<\/p>\n\n\n\n<p>&#8216; Run wuauclt.exe with resetauthorization<\/p>\n\n\n\n<p>sCmd = &#8220;%SystemRoot%\\system32\\wuauclt.exe \/resetauthorization \/detectnow&#8221;<\/p>\n\n\n\n<p>oShell.Run sCmd, 0, True<\/p>\n\n\n\n<p>&#8216; create marker<\/p>\n\n\n\n<p>oShell.RegWrite sRegKey &amp; &#8220;\\IDDeleted&#8221;, &#8220;yes&#8221;<\/p>\n\n\n\n<p>End If<\/p>\n\n\n\n<p>Note: this should be copied and saved as a .vbs file. I&#8217;ve also attached it as a file to this post, needs to be renamed though!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Set oShell = CreateObject(\"WScript.Shell\") \n\nsRegKey = \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\" \npRegKey = \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections\"\n \n' suppress error in case values does not exist \nOn Error Resume Next \n\n' check for marker \nsIDDeleted = oShell.RegRead( sRegKey &amp; \"\\IDDeleted\") \n\n' to be sure values is only deleted once, test on marker \nIf sIDDeleted &lt;> \"yes\" Then \n\t\n  ' delete any WinHttpSettings registry entry (interferes with WSUS)\n  oshell.RegDelete pRegKey &amp; \"\\WinHttpSettings\"\n\n  ' delete values \n  oShell.RegDelete sRegKey &amp; \"\\AccountDomainSid\" \n  oShell.RegDelete sRegKey &amp; \"\\PingID\" \n  oShell.RegDelete sRegKey &amp; \"\\SusClientId\" \n\n  ' Stop and start the Automatic updates service \n  oShell.Run \"%SystemRoot%\\system32\\net.exe stop wuauserv\", 0, True \n  oShell.Run \"%SystemRoot%\\system32\\net.exe start wuauserv\", 0, True \n\n  ' Run wuauclt.exe with resetauthorization \n  sCmd = \"%SystemRoot%\\system32\\wuauclt.exe \/resetauthorization \/detectnow\" \n  oShell.Run sCmd, 0, True \n\n  ' create marker \n  oShell.RegWrite sRegKey &amp; \"\\IDDeleted\", \"yes\"\n\nEnd If\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Reset WSUS ClientBeen working on WSUS and have setup a WSUS server. However started to get a problem whereby the computers were appearing on WSUS and reporting their status then disappearing. I noticed that they were disappearing and being replaced by another computer. It turns out that when a machine is ghosted and then sysprep&#8217;ed &#8230; <a title=\"WSUS &#8211; Computers reporting and then disappearing\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=521\" aria-label=\"Read more about WSUS &#8211; Computers reporting and then disappearing\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-521","post","type-post","status-publish","format-standard","hentry","category-microsoft-windows"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/521","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=521"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/521\/revisions"}],"predecessor-version":[{"id":1580,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/521\/revisions\/1580"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}