Open in the explorer

At logoff, delete local copy of user’s offline files

À la fermeture de session, supprimer les copies locales des fichiers hors connexion de l’utilisateur

Type
Computer
GPO path
Computer Configuration › Policies › Administrative Templates › Network › Offline Files FR: Configuration ordinateur › Stratégies › Modèles d'administration › Réseau › Fichiers hors connexion
Supported on
Windows Server 2003, Windows XP, and Windows 2000 only FR: Windows Server 2003, Windows XP et Windows 2000 uniquement
ADMX file
OfflineFiles.admx
Internal name
OfflineFiles/Pol_PurgeAtLogoff

Explanation

Deletes local copies of the user's offline files when the user logs off.

This setting specifies that automatically and manually cached offline files are retained only while the user is logged on to the computer. When the user logs off, the system deletes all local copies of offline files.

If you disable this setting or do not configure it, automatically and manually cached copies are retained on the user's computer for later offline use.

Caution: Files are not synchronized before they are deleted. Any changes to local files since the last synchronization are lost.

French text from Windows 11 26H2

Supprime les copies locales des fichiers hors connexion de l’utilisateur lorsque ce dernier ferme une session.

Ce paramètre spécifie que les fichiers hors connexion mis en cache manuellement ou automatiquement ne sont conservés que pendant la durée de la session de l’utilisateur sur l’ordinateur. Quand l’utilisateur ferme la session, le système supprime toutes les copies locales des fichiers hors connexion.

Si ce paramètre est désactivé ou n’est pas configuré, les copies mises en cache manuellement ou automatiquement sont conservées sur l’ordinateur de l’utilisateur pour une utilisation hors connexion ultérieure.

Attention : les fichiers ne sont pas synchronisés avant d’être supprimés. Toutes les modifications apportées aux fichiers locaux depuis la dernière synchronisation seront perdues.

Registry

HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache
Value name
PurgeAtLogoff
StateValue written
Enablednot defined in the ADMX (see the options below)
Disablednot defined in the ADMX (see the options below)

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

The ADMX does not specify the value written when enabled; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled). The commands below use 1/0 as an assumption.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: OfflineFiles/Pol_PurgeAtLogoff
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'PurgeAtLogoff' -Value 1 -Type DWord  # assumed value (not defined in the ADMX)
# Delete only the temporary offline files.
# unchecked: 0
Set-ItemProperty -Path $k -Name 'PurgeOnlyAutoCacheAtLogoff' -Value 1 -Type DWord

Disable

# Disable: OfflineFiles/Pol_PurgeAtLogoff
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'PurgeAtLogoff' -Value 0 -Type DWord  # assumed value (not defined in the ADMX)

Revert to "Not configured"

# Revert to "Not configured": OfflineFiles/Pol_PurgeAtLogoff
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
Remove-ItemProperty -Path $k -Name 'PurgeAtLogoff' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'PurgeOnlyAutoCacheAtLogoff' -ErrorAction SilentlyContinue

Options (1)

LabelControlRegistry valueREG typeConstraints / details
Delete only the temporary offline files.Supprimer uniquement les versions hors connexion temporaires.Lbl_PurgeOnlyAutoCachedFilesCheck boxbooleanPurgeOnlyAutoCacheAtLogoffREG_DWORD
Checked: REG_DWORD = 1
Unchecked: REG_DWORD = 0

Availability