delete Google Chrome Cache in roaming profile

<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This question does not show any research effort; it is unclear or not useful" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary"></button>

How to delete Google Chrome Cache in roaming profile on Virtual Desktops & stored path on server

//Server/location%username%/AppData\Roaming\Google\Chrome\User Data\Default\Code Cache\js

and another location

//virtualmachine/AppData\Roaming\Google\Chrome\User Data\Default\Code Cache\js This changes all the time with machine now. Could anyone help Thanks.

I have done as below in a machine which works fine but unsure how it works for differnt laptopn number or pick all user name from a folder through "if"

The one worked is

$Now = Get-Date
$Days = “30”
$TargetFolder = “\vmpvdb256\c$\Users\username\AppData\Roaming\Google\Chrome\User Data\Default\Code Cache\js”
$LastWrite = $Now.AddDays(-$Days)
$Files = Get-Childitem $TargetFolder -Include $Extension -Recurse | Where {$_.LastWriteTime -le “$LastWrite”}
foreach ($File in $Files) {
if ($File -ne $NULL)
{
write-host “Deleting File $File” -ForegroundColor “Yellow”
Remove-Item $File.FullName | out-null
}
else
{
Write-Host “Archive cleanup complete. No more files to delete!” -foregroundcolor “Green”
}
}

 

Thanks.

Wolfgang

Hi,

I’m not quite sure what you mean with the locations, but this should do the trick for all users on local machine. -Include needs to have * in the end of the path and I didn’t get that to work, so I went to the slower path of checking the extensions in where statement.

[pre]

$Extension = “html”,“json”
$Days = 30
$TargetFolder = “C:\Users*\AppData\Roaming\Google\Chrome\User Data\Default\Code Cache\js”
Get-Childitem $TargetFolder -Recurse | Where {$.LastWriteTime -le $(Get-Date).AddDays(-$Days) -and $Extension -contains $.extension} | Remove-Item -Verbose

[/pre]