Resolve the CBS.log file size problem
Resolve the CBS.log file size problem

System File Checker is a utility in Windows that allows users to scan for corruptions in Windows system files and restore corrupted files. The exe file, sfc.exe, generates a log file called %windir%\Logs\CBS\CBS.log.

The Sfc.exe program writes the details of each verification operation and of each repair operation to the CBS.log file. Each SFC.exe program entry in the CBS.log file has an [SR] tag.

In some cases, the log file %windir%\Logs\CBS\CBS.log can be huge (more than 1GB).

You can resolve/bypass this problem by deleting the log file. To do that, follow these steps :

  • stop the windows service
    PS C:\> get-service | ? { $_.displayname -match "Windows Modules Installer"}
    
    Status   Name               DisplayName
    ------   ----               -----------
    Running  TrustedInstaller   Windows Modules Installer
    
    PS C:\> get-service | ? { $_.displayname -match "Windows Modules Installer"} | stop-service
    
  • delete the CBS log file
    PS C:\> get-childitem C:\Windows\Logs\CBS\CBS.log
    
    
        Directory: C:\Windows\Logs\CBS
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----       12.09.2016     10:57        7338314 CBS.log
    
    PS C:\> get-childitem C:\Windows\Logs\CBS\CBS.log | remove-item
    
  • start the service
    PS C:\> get-service | ? { $_.displayname -match "Windows Modules Installer"} | start-service
    

References

Sfc

Scans and verifies the integrity of all protected system files and replaces incorrect versions with correct versions.

For examples of how to use this command, see Examples.

Syntax
sfc [/scannow] [/verifyonly] [/scanfile=] [/verifyfile=] [/offwindir= /offbootdir=]
Parameters
Parameter Description
/scannow Scans the integrity of all protected system files and repairs files with problems when possible.
/verifyonly Scans integrity of all protected system files. No repair operation is performed.
/scanfile Scans integrity of the specified file and repairs the file if problems are detected, when possible.
Specified full path and filename
/verifyfile Verifies the integrity of the specified file. No repair operation is performed.
/offwindir Specifies the location of the offline windows directory, for offline repair.
/offbootdir Specifies the location of the offline boot directory for offline
/? Displays Help at the command prompt.
Remarks
  • You must be logged on as a member of the Administrators group to run sfc.exe.
  • If sfc discovers that a protected file has been overwritten, it retrieves the correct version of the file from the systemroot\system32\dllcachefolder, and then replaces the incorrect file.
  • There are functional differences between sfc on Windows Server® 2003, Windows Server® 2008, and Windows Server® 2008 R2:
  • For more information about sfc on Windows Server 2003, see article 310747 in the Microsoft Knowledge Base.
  • For more information about sfc on Windows Server® 2008, and Windows Server® 2008 R2, see System File Checker.
Examples

To verify the kernel32.dll file, type:

sfc /verifyfile=c:\windows\system32\kernel32.dll

To setup offline repair of the kernel32.dll file with an offline boot directory set to d: and offline windows directory set to d:\windows, type:

sfc /scanfile=d:\windows\system32\kernel32.dll /offbootdir=d:\ /offwindir=d:\windows
<><>
Resolve the CBS.log file size problem

Leave a Reply

Your email address will not be published.