Cleaning Week: Deleting CBS Log File

by Jun 1, 2016

Windows maintains a log file named cbs.log in $env:windir\logs\cbs. It logs various pieces of information related to the Windows trusted installer, for example the installation of windows updates, and can grow massively in size.

That’s why Windows typically moves the log file to a CAB file once it grows beyond 50MB. In a previous tip you learned how you can get rid of these persisted CAB files.

It may pay off to have an eye on the cbs.log file itself, too, though. Occasionally, the log grows so rapidly in size that it grows beyond 2GB before it can be moved to a CAB file. Since CAB files can handle only a maximum of 2GB, if this happens the log file will continue to grow uncompressed forever, and may quickly fill your entire hard disk.

Here is how PowerShell can delete the cbs.log file if it gets out of control (you can safely delete this file; the trusted installer creates a new one if it can’t find it):

#requires -Version 1
#Requires -RunAsAdministrator
# must run with admin privileges!
Stop-Service TrustedInstaller
Remove-Item -Path C:\Windows\Logs\CBS\CBS.log
Start-Service TrustedInstaller

To delete the log file, you just need to make sure that the trusted installer isn’t accessing (and locking) the file.

Twitter This Tip! ReTweet this Tip!