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:

  1. Open the Registry Editor:
    • Press Windows Key + R to open the Run dialog box.
    • Type regedit and press Enter or click OK.
    • If prompted by User Account Control (UAC), click Yes to grant administrative privileges.
  2. 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 NetCache key does not exist under Windows, right-click the Windows folder, select New > Key, and name it NetCache.
  3. Create or Modify the PurgeAtLogoff Value:
    • Right-click the NetCache folder in the left pane or empty space in the right pane.
    • Select New > DWORD (32-bit) Value.
    • Name the new value PurgeAtLogoff and press Enter.
  4. Set the Value Data:
    • Double-click the PurgeAtLogoff entry.
    • In the Value data field, change the value from 0 to 1.
    • Ensure the Base is set to Hexadecimal, then click OK.
  5. 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.