Windows Server 2019 Remote Desktop Services (RDS) servers often host dozens of simultaneous users. Google Chrome is usually the preferred web browser, but over time its cache grows significantly. A single user profile may consume anywhere from 1 GB to over 10 GB, resulting in hundreds of gigabytes of wasted storage on busy servers.
Fortunately, administrators can safely clean Chrome's temporary cache using PowerShell without deleting bookmarks, saved passwords, browser extensions, or user settings.
This guide demonstrates practical PowerShell commands for enterprise administrators and explains how to automate Chrome cache cleanup safely.
Chrome stores temporary website data to improve browsing performance. The following data accumulates over time:
Although these files improve loading speed, they are automatically recreated and can safely be removed.
Each Windows user has a Chrome profile stored under:
C:\Users\<Username>\AppData\Local\Google\Chrome\User Data
Example:
C:\Users\John\AppData\Local\Google\Chrome\User Data
Display the size of a user's Chrome profile:
$Folder = "C:\Users\John\AppData\Local\Google\Chrome"
(Get-ChildItem $Folder -Recurse -Force | Measure-Object Length -Sum).Sum /1GB
Get-ChildItem C:\Users -Directory
Get-ChildItem "C:\Users" -Directory | ForEach-Object {
$Chrome = "$($_.FullName)\AppData\Local\Google\Chrome\User Data"
if(Test-Path $Chrome){
Write-Host $Chrome
}
}
Get-ChildItem C:\Users -Directory | ForEach-Object {
$Folder="$($_.FullName)\AppData\Local\Google"
if(Test-Path $Folder){
$Size=(Get-ChildItem $Folder -Recurse -Force -EA SilentlyContinue | Measure Length -Sum).Sum
[PSCustomObject]@{
User=$_.Name
SizeGB=[math]::Round($Size/1GB,2)
}
}
} | Sort SizeGB -Descending
Always close Chrome before cleaning.
Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Force
or
taskkill /F /IM chrome.exe
Delete only these folders:
Cache
Code Cache
GPUCache
ShaderCache
GrShaderCache
Media Cache
Crashpad
DawnCache
Service Worker\CacheStorage
These folders contain only temporary data.
$Folders=@(
"Cache",
"Code Cache",
"GPUCache",
"ShaderCache",
"GrShaderCache",
"Media Cache",
"Crashpad",
"DawnCache",
"Service Worker\CacheStorage"
)
$Base="C:\Users\John\AppData\Local\Google\Chrome\User Data"
Get-ChildItem $Base -Directory | ForEach-Object{
foreach($Folder in $Folders){
$Target=Join-Path $_.FullName $Folder
if(Test-Path $Target){
Remove-Item $Target -Recurse -Force
}
}
}
Get-ChildItem C:\Users -Directory | ForEach-Object{
$Chrome="$($_.FullName)\AppData\Local\Google\Chrome\User Data"
if(Test-Path $Chrome){
Get-ChildItem $Chrome -Directory | ForEach-Object{
$Folders=@(
"Cache",
"Code Cache",
"GPUCache",
"ShaderCache",
"GrShaderCache",
"Media Cache",
"Crashpad",
"DawnCache",
"Service Worker\CacheStorage"
)
foreach($Folder in $Folders){
$Target=Join-Path $_.FullName $Folder
if(Test-Path $Target){
Remove-Item $Target -Recurse -Force -EA SilentlyContinue
}
}
}
}
}
$Before=(Get-PSDrive C).Free
# Cleanup Here
$After=(Get-PSDrive C).Free
"Recovered {0:N2} GB" -f (($After-$Before)/1GB)
Start-Transcript C:\ChromeCleanup.log
# Run cleanup commands
Stop-Transcript
Remove-Item "C:\Windows\Temp\*" -Force -Recurse -EA SilentlyContinue
Get-ChildItem C:\Users -Directory | ForEach-Object{
Remove-Item "$($_.FullName)\AppData\Local\Temp\*" -Recurse -Force -EA SilentlyContinue
}
Clear-RecycleBin -Force
Stop Windows Update service:
Stop-Service wuauserv
Delete update cache:
Remove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force
Restart service:
Start-Service wuauserv
Get-ChildItem C:\Users -Directory | ForEach-Object{
$Size=(Get-ChildItem $_.FullName -Recurse -EA SilentlyContinue | Measure Length -Sum).Sum
[PSCustomObject]@{
User=$_.Name
SizeGB=[math]::Round($Size/1GB,2)
}
} | Sort SizeGB -Descending
Create a Scheduled Task that:
This ensures cleanup occurs when users are logged off and minimizes disruption.
Organizations using automated Chrome cache cleanup can expect:
PowerShell provides a reliable, repeatable, and enterprise-friendly method for cleaning Google Chrome cache across all user profiles on Windows Server 2019. By targeting only temporary cache folders, administrators can reclaim substantial disk space without affecting user data. When combined with scheduled maintenance, logging, and routine monitoring, Chrome cache cleanup becomes an essential part of maintaining a healthy Remote Desktop Services environment.
Regular maintenance using the techniques in this guide helps improve server performance, extend storage life, and reduce administrative overhead while preserving the browsing experience for end users.