Clear Cache of all severs in one go


Today I am providing the Power Shell Script that will clear the cache configuration from all SharePoint servers in one go.

You have to provide all server names of the farm in the script. Provide individual server names inside double coutos ("), and separated by coma as shown in the script itself and Modify the script and provide the Server names. For getting GUID for configuration go to following path in registry editor of any one server (app or wfe). Here copy the GUID and provide it as input when asked by the script. "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15\Secure\ConfigDB" for SharePoint 2013 or "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14\Secure\ConfigDB" for Sharepoint 2010

You can also follow this path in any one server (app or wfe) of the farm “C:\ProgramData\Microsoft\SharePoint\Config” and look for a folder which contains XML files and one cache.ini file. And provide this folder path to the script. This GUID is same for all servers in a Farm.

.Inputs

Cache GUID - you can get this GUID from "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15\Secure\ConfigDB" for SharePoint 2013 or "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14\Secure\ConfigDB" for Sharepoint 2010

.Outputs

This script will clear the cache configuration from all SharePoint servers in one go

Example-

.\scriptname.ps1

.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies -
For executing this script user must be added in site collection administrators given site.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.


FOR ANY HELP ON THIS SCRIPT USE "GET-HELP .\SCRIPTNAME.PS1 --FULL" AFTER SAVING THIS FILE.


Go to above link to get the script.

 

2 comments: