Clear CBS Logs before eat all HDD space.
There is a recurring issue with Windows 2008 and 2012 VM's where the Windows Modules Installer has issues and the CBS.log file continues to grow and consumes all available HDD space.
The Procedure is built for 64 Bit OS's and will notify you if a 32 bit OS is encountered. Next the AP will stop and disable the Windows Modules Installer, delete all files from the Windows\Logs\CBS directory and enable - restart the Windows Modules Installer service. During testing I found that the TrustedInstaller Service can sometimes stall when stopping the service hence I also disabled it in the PS. Your preferred restart AP can be inserted directly after via statement to reboot the system then continue the deletion.
I agree with Jaime on changing the "DEL C*" to DEL C*.log" (else I would have given 5 Stars), but other than that, this is a great script. Like many of you, we monitor servers in the 100's and while I get a report weekly that show which ones a having disk space issues, the CBS Logs are frequently a major contributor. I often find 20 to 25 GBs of CBS log files. It takes a while for my system to accumulate that much, so I have set the script to run every other month.
For one customer we have weekly issues with these logs. They do their own local management, we just monitor it for them. Without costing us a lot of time, we can help them clean their machines, which is great. Thanks!
Great script. Odd, no 32-bit support. While I have *yet* to have this problem, I personally wouldn't use "DEL C*". File Extension targeting is almost always better, and so maybe "DEL C*.log" will still resolve this issue while reducing possible risk?
A good start on the script and with just a few minor tweaks it works great! My recommendations: Change your log entries from Windows Management Instrumentation to Windows Modules Installer as that is the service you are targeting. Also, execute your shell command for as System in a 64 bit shell. I have already added it to my production scripts - Thanks for sharing!
Clear CBS Logs has no comments.