![]() Message -Severity 1 -component "Error" exit $MinDays = 20 Write-Log -Message "Checking for the folders which is older than $MinDays days" -severity 1 -component "Information" $UIResourceMgr = New-Object -ComObject UIResource.UIResourceMgr $Cache = $UIResourceMgr. ![]() Write-Log -Message "Checking for CCMCache folder size" -severity 1 -component "Information" $FolderSize = Get-Size -Path "C:\Windows\ccmcache\" Write-Log -Message "Current CCMCache Folder size :: $FolderSize GB" -Severity 1 -component "Information" if ( $FolderSize -gt 3 ) Write-Log -Message "Script started to cleanup the CCMCache" -severity 1 -component "Script Start" Write-Log -Message "Checking for OS drive Information before deletion" -severity 3 -component "Script Start" Get-DiskInfo # calling disk info Remove-Item C:\wbg\Logs\CCMCacheCleanup.log -Force -ErrorAction Silentlåontinue If(Test-Path -Path C:\wbg\Logs\CCMCacheCleanup.log -ErrorAction Silentlåontinue ) This script will create a log file to verify the which folders are going to delete and C drive information before & after delete, this way you can see the how much free space avilable after deletion. Script will start the delete the folders based on below criteria: I am not going to show you how to create CI in SCCM because there are many blogs will talk about it in detailed. ![]() In my company i have used SCCM CI to deploy this script. Below script will be helpful for you to cleanup your CCMCache Folder.There are multiple ways you can deploy this script to your endpoints. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |