Introduction
In March 2025, our team planned a major upgrade: moving all machines to Windows 11 24H2. It sounded simple until we hit one of the biggest problems—storage. Each machine only had 128GB of allocated space, and during investigation, we found some users had 50GB+ Outlook OST files clogging their systems.

The Storage Nightmare
When we discovered the oversized OST files, we needed a quick fix. Our first idea was to change the Windows Group Policy and set Outlook to online mode (which prevents local .ost cache from being created).
However, this came with a drawback: several users reported Outlook felt slower than usual. Because of this, we had no choice but to roll back the policy change.
The Smarter Solution
Instead of removing the policy completely, we set a new rule: Outlook would only store 2 months of cache locally. But before applying this, we needed to delete the existing cache, which in some cases had grown to 50–70GB per user.
Doing this manually on 5,000 machines would have been a nightmare. That’s when I came up with a clever PowerShell scripting solution.
PowerShell to the Rescue
I wrote a script on my server that remotely deleted Outlook cache across the network. Before deploying it on production machines, I tested it thoroughly on both pre-production and selected production test systems—and it worked flawlessly.
At midnight, I ran the script across the domain-joined machines. By morning, the caches were gone. What would have taken weeks manually was completed overnight.
# Create a text file with hostname in it.
$names = Get-Content “Replace it with destination path I.e. C:\temp\hostname.txt”
foreach ($n in $names) {
Write-Output “Processing machine: $n”
# Get users on the remote machine
$users = Get-ChildItem -Path “\\$n\C$\Users” -Directory
foreach ($user in $users) {
$ostPath = “\\$n\C$\Users\$($user.Name)\AppData\Local\Microsoft\Outlook”
if (Test-Path $ostPath) {
Get-ChildItem -Path $ostPath -Filter “*.ost” -File | Remove-Item -Force
Write-Output “$($n),Deleted .ost files from: $ostPath”
} else {
Write-Output “$($n),No OST files found for user: $($user.Name)”
}
}
}
How to Fix Outlook OST File Issues in Windows 11
If you’re facing the same issue, here’s how you can apply this solution:
- Identify machines with large OST files.
- Apply a Group Policy to limit cache (e.g., 2 months).
- Use a PowerShell script to clear the existing cache.
- Test in a controlled environment before deploying at scale.
Takeaway
Deleting cache from 5,000+ machines in one night would have been impossible without scripting. This experience taught me one thing. Always automate repetitive IT tasks—scripting saves time and sanity.
Check Out my other Blogs:
