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’ed it doesnt reset the WSUS id, which is a unique ID that WSUS uses to track the computer. So i’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.
Set oShell = CreateObject(“WScript.Shell”)
sRegKey = “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate”
pRegKey = “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections”
‘ suppress error in case values does not exist
On Error Resume Next
‘ check for marker
sIDDeleted = oShell.RegRead( sRegKey & “\IDDeleted”)
‘ to be sure values is only deleted once, test on marker
If sIDDeleted <> “yes” Then
‘ delete any WinHttpSettings registry entry (interferes with WSUS)
oshell.RegDelete pRegKey & “\WinHttpSettings”
‘ delete values
oShell.RegDelete sRegKey & “\AccountDomainSid”
oShell.RegDelete sRegKey & “\PingID”
oShell.RegDelete sRegKey & “\SusClientId”
‘ Stop and start the Automatic updates service
oShell.Run “%SystemRoot%\system32\net.exe stop wuauserv”, 0, True
oShell.Run “%SystemRoot%\system32\net.exe start wuauserv”, 0, True
‘ Run wuauclt.exe with resetauthorization
sCmd = “%SystemRoot%\system32\wuauclt.exe /resetauthorization /detectnow”
oShell.Run sCmd, 0, True
‘ create marker
oShell.RegWrite sRegKey & “\IDDeleted”, “yes”
End If
Note: this should be copied and saved as a .vbs file. I’ve also attached it as a file to this post, needs to be renamed though!
Set oShell = CreateObject("WScript.Shell")
sRegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate"
pRegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
' suppress error in case values does not exist
On Error Resume Next
' check for marker
sIDDeleted = oShell.RegRead( sRegKey & "\IDDeleted")
' to be sure values is only deleted once, test on marker
If sIDDeleted <> "yes" Then
' delete any WinHttpSettings registry entry (interferes with WSUS)
oshell.RegDelete pRegKey & "\WinHttpSettings"
' delete values
oShell.RegDelete sRegKey & "\AccountDomainSid"
oShell.RegDelete sRegKey & "\PingID"
oShell.RegDelete sRegKey & "\SusClientId"
' Stop and start the Automatic updates service
oShell.Run "%SystemRoot%\system32\net.exe stop wuauserv", 0, True
oShell.Run "%SystemRoot%\system32\net.exe start wuauserv", 0, True
' Run wuauclt.exe with resetauthorization
sCmd = "%SystemRoot%\system32\wuauclt.exe /resetauthorization /detectnow"
oShell.Run sCmd, 0, True
' create marker
oShell.RegWrite sRegKey & "\IDDeleted", "yes"
End If