Clear SharePoint Config Cache with PowerShell


In my previous post, I have explained about issue “An update conflict has occurred, and you must re-try this action”. That issue occurs because of cache issues. I have already explained the manual way to clear cache. In this blog, I do same thing using the poweshell script. Following code of PowerShell will clear the cache of the server:

Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

Stop-Service SPTimerV4
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
if ($item.Name.ToLower() -eq “cache.ini”)
$cachefolder = $folder.FullName

$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
if ($cachefolderitem -like “*.xml”)


$a = Get-Content  $cachefolder\cache.ini
$a  = 1
Set-Content $a -Path $cachefolder\cache.ini

read-host “Do this on all your SharePoint Servers – and THEN press ENTER”
start-Service SPTimerV4

Thanks and Happy SharePointing 🙂


Published by Mohit Vashishtha

Having extensive experience in software industry as a Team Lead and SharePoint consultant. I have worked with various MS technologies like SharePoint, .Net, AngularJS and Angular 6. I love to learn and share new things which I learn during my experience.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: