Purge Offline Files Cache at Logoff Using Regedit
This guide explains how system administrators can configure Windows to automatically purge the Offline Files (Client-Side Caching or CSC) cache whenever a user logs off. By modifying a specific value in the Windows Registry using Regedit, you can ensure that temporary offline copies of network files are removed at the end of every session, enhancing security on shared workstations and preventing stale cache buildup.
Steps to Configure Cache Purging at Logoff
Follow these steps to configure the registry setting:
- Open the Registry Editor:
- Press
Windows Key + Rto open the Run dialog box. - Type
regeditand pressEnteror click OK. - If prompted by User Account Control (UAC), click Yes to grant administrative privileges.
- Press
- Navigate to the NetCache Policy Key:
- In the left navigation pane, browse to the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\NetCache - Note: If the
NetCachekey does not exist underWindows, right-click theWindowsfolder, select New > Key, and name itNetCache.
- In the left navigation pane, browse to the following path:
- Create or Modify the PurgeAtLogoff Value:
- Right-click the
NetCachefolder in the left pane or empty space in the right pane. - Select New > DWORD (32-bit) Value.
- Name the new value
PurgeAtLogoffand pressEnter.
- Right-click the
- Set the Value Data:
- Double-click the
PurgeAtLogoffentry. - In the Value data field, change the value from
0to1. - Ensure the Base is set to Hexadecimal, then click OK.
- Double-click the
- Apply the Changes:
- Close the Registry Editor.
- Restart the computer or log off and back on for the policy to take effect.
How to Revert the Setting
To disable this behavior and retain offline files across user
sessions, return to the
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\NetCache
registry path and either set the PurgeAtLogoff value data
back to 0 or delete the PurgeAtLogoff DWORD
entry entirely.