Seems like there are times that we need to delete the entire Client Cache folder because the Options - Clear Client Cache process just doesn’t get rid of everything that we need it to.
Here is a simple little PowerShell Script that can be used to delete the Client Cache Folder on a User’s Local System. You could just keep the PS shortcut in a central location on the network where users could run it on their own…(they may need to right-click it and select Run As Administrator.) Thought this might be easier than having them remember the path with the hidden ProgramData directory.
Just PLEASE make sure you test this and verify the path and name of the Client Cache Folder before you deploy this to your user(s).
#Specify Name and Location of the Client Cache Folder on a Local PC
#Make sure that you have the Client Cache Folder name correct!
$ClientCacheFolder = 'C:\ProgramData\Epicor\erplive-808'
#Check to see if Client Cache Folder exists
#If script says folder DNE but you know it is there then try (Test-Path $ClientCacheFolder -ErrorAction Inquire)
If (Test-Path $ClientCacheFolder)
{
Try
{
#Try to Remove\Delete ENTIRE Client Cache Folder on local PC
#Stop if Error received
Remove-Item $ClientCacheFolder* -Recurse -Force -ErrorAction Stop
#If no Error then report Success
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Entire Client Cache Folder - " + $ClientCacheFolder.Split('\')[-1] + " - has been Deleted. `nOperation Complete.",0,"Done",0x1)
}
CATCH
{
#Error received when removing Folder, report problem to user
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Cannot Delete Folder - Files Locked by user. Close out of Epicor and try again.",0,"Done",0x1)
}
}
Else
{
#Client Cache Folder was not found
$wshell = New-Object -ComObject Wscript.Shell
$wshell.Popup("Folder Does Not Exist",0,"Done",0x1)
}
Save this code as a PowerShell (.ps1) script to a unadvertised shared network location. I called my file PSS_ClearEntireClientCacheFolder.ps1 (for reference below).
Create a New Shortcut and point it to this PowerShell Script:
Shortcut - Target Path Example:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned -command "& ‘\ \servername\EpicorStuff\Epicor10\PowerShell\PSS_ClearEntireClientCacheFolder.ps1’
Move Read-only shortcut to shared network location where Users can run it from their Systems.
Just FYI: If you Shift + right-click on the Shortcut and choose Run As Different User and enter a domain Admin login and password you can use a $ClientCacheFolder path like: \ \PC27\C$\ProgramData\Epicor\erplive-808 in the script and run it remotely. Not that you couldn’t do this manually but maybe this would be helpful to run this way? (Just be careful changing the $ClientCacheFolder path if others are using the script maybe make a copy for Admin usage.)
Just throwing this out there in the hopes that it might be helpful to someone.