PowerShell Guide to Safely Clean Google Chrome Cache for All Users on Windows Server 2019 & Remote Desktop Services (RDS)

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.

Advertisement

This guide demonstrates practical PowerShell commands for enterprise administrators and explains how to automate Chrome cache cleanup safely.


Why Chrome Cache Consumes So Much Space

Chrome stores temporary website data to improve browsing performance. The following data accumulates over time:

  • Website images
  • JavaScript files
  • CSS files
  • Cached videos
  • Fonts
  • Temporary downloads
  • GPU rendering cache
  • Service Worker cache
  • Crash reports

Although these files improve loading speed, they are automatically recreated and can safely be removed.


Chrome User Profile Location

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

Check Chrome Folder Size

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

List All User Profiles

Get-ChildItem C:\Users -Directory

Locate Chrome Profiles

Get-ChildItem "C:\Users" -Directory | ForEach-Object {

$Chrome = "$($_.FullName)\AppData\Local\Google\Chrome\User Data"

if(Test-Path $Chrome){

Write-Host $Chrome

}

}

Find Users Consuming the Most Chrome Storage

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

Safely Stop Chrome

Always close Chrome before cleaning.

Get-Process chrome -ErrorAction SilentlyContinue | Stop-Process -Force

or

taskkill /F /IM chrome.exe

Safe Cache Folders

Delete only these folders:

Cache
Code Cache
GPUCache
ShaderCache
GrShaderCache
Media Cache
Crashpad
DawnCache
Service Worker\CacheStorage

These folders contain only temporary data.


Delete Cache for One User

$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

}

}

}

Delete Cache for Every User

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

}

}

}

}

}

Display Total Disk Space Recovered

$Before=(Get-PSDrive C).Free

# Cleanup Here

$After=(Get-PSDrive C).Free

"Recovered {0:N2} GB" -f (($After-$Before)/1GB)

Generate Cleanup Log

Start-Transcript C:\ChromeCleanup.log

# Run cleanup commands

Stop-Transcript

Delete Windows Temporary Files

Remove-Item "C:\Windows\Temp\*" -Force -Recurse -EA SilentlyContinue

Delete User Temporary Files

Get-ChildItem C:\Users -Directory | ForEach-Object{

Remove-Item "$($_.FullName)\AppData\Local\Temp\*" -Recurse -Force -EA SilentlyContinue

}

Empty Recycle Bin

Clear-RecycleBin -Force

Clean Windows Update Cache

Stop Windows Update service:

Stop-Service wuauserv

Delete update cache:

Remove-Item "C:\Windows\SoftwareDistribution\Download\*" -Recurse -Force

Restart service:

Start-Service wuauserv

Analyze the Largest Directories

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

Schedule Automatic Cleanup

Create a Scheduled Task that:

  • Runs every Sunday
  • Executes at 2:00 AM
  • Runs as SYSTEM
  • Runs with highest privileges

This ensures cleanup occurs when users are logged off and minimizes disruption.


Best Practices

  • Close Chrome before cleaning.
  • Never delete Bookmarks, Login Data, or Preferences.
  • Back up important profiles before large maintenance.
  • Perform cleanup during off-hours.
  • Maintain logs of reclaimed disk space.
  • Monitor profile growth monthly.
  • Test scripts in a non-production environment before enterprise deployment.

Benefits of PowerShell Automation

Organizations using automated Chrome cache cleanup can expect:

  • Recover tens or hundreds of gigabytes of storage.
  • Faster Remote Desktop login times.
  • Reduced backup sizes.
  • Improved disk performance.
  • Healthier user profiles.
  • Less manual maintenance.
  • Consistent server performance.

Conclusion

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.

 

#PowerShell #PowerShellScript #WindowsServer #WindowsServer2019 #WindowsServer2022 #RemoteDesktop #RDS #ChromeCache #GoogleChrome #ChromeCleanup #SystemAdministrator #SysAdmin #ITSupport #WindowsAdmin #ServerMaintenance #Automation #TaskScheduler #DiskCleanup #StorageOptimization #WindowsPowerShell #EnterpriseIT #ServerOptimization #BrowserCache #ChromeProfile #WindowsTips #TechTips #Infrastructure #PerformanceTuning #ITInfrastructure #Microsoft #Windows #BrowserOptimization #ServerHealth #CleanupScript #WindowsManagement #ChromeBrowser #ProfileCleanup #DataCleanup #WindowsMaintenance #StorageManagement #ServerAdministration #EnterpriseComputing #CacheCleanup #ITProfessionals #TechnicalGuide #WindowsOptimization #PowerShellAutomation #ChromeMaintenance #BisonInfosolutions #WindowsCommands

 
 


PowerShell PowerShell script Chrome cache cleanup Google Chrome cache Windows Server 2019 Windows Server 2022 Remote Desktop Services RDS Chrome User Data AppData cleanup Chrome automation Windows PowerShell System Administrator Server Mainte
Advertisement