Enable WSUS Client Trace Logging
In this article, we will discuss how to enable trace logging for the Windows Update Agent on a Windows device. This can also be considered debug, or verbose logging. With this enabled the WindowsUpdate.log file, and the corresponding event logs will contain more information which is helpful for troubleshooting.
Topics covered in this article:
Enable trace logging manually
First, a registry key must be created at the location HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Trace. The WindowsUpdate key should already exist, but the Trace key will need to be created.
Once this is created two REG_DWORD values must be made as noted below, and also shown in the picture above.
- Flags = 7
- Level = 4
Lastly, the Windows Update service must be restarted. This can be done in many ways. The services MMC method is shown below by simply right-clicking the Windows Update service and selecting restart.
Enable trace logging with a PowerShell snippet
A script is available on GitHub here to perform the registry edits and restart the service for both enabling and disabling the trace logging. An example of running the script is shown below. The execution policy may need to be adjusted depending on the configuration of the device the script is being run on.
. “C:\temp\Set-WSUSTraceLogging.ps1” -TraceLogging Enabled
Note: Once you have enabled or disabled trace logging you can collect the logs using the Get-WindowsUpdateLog PowerShell cmdlet, or review the event logs. More information regarding the Windows Update logs can be found within the Microsoft documentation found here.