Remove "Work offline" command
Supprimer la commande « Travailler hors connexion »
Explanation
This policy setting removes the "Work offline" command from Explorer, preventing users from manually changing whether Offline Files is in online mode or offline mode.
If you enable this policy setting, the "Work offline" command is not displayed in File Explorer.
If you disable or do not configure this policy setting, the "Work offline" command is displayed in File Explorer.
Ce paramètre de stratégie supprime la commande « Travailler hors connexion » de l’Explorateur pour empêcher les utilisateurs de modifier manuellement le mode hors connexion ou le mode connexion des fichiers hors connexion.
Si vous activez ce paramètre de stratégie, la commande « Travailler hors connexion » n’est pas affichée dans l’Explorateur de fichiers.
Si vous désactivez ou ne configurez pas ce paramètre de stratégie, la commande « Travailler hors connexion » est affichée dans l’Explorateur de fichiers.
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\NetCache- Value name
WorkOfflineDisabled
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_DWORD = 0 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
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_WorkOfflineDisabled_2
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'WorkOfflineDisabled' -Value 1 -Type DWordDisable
# Disable: OfflineFiles/Pol_WorkOfflineDisabled_2
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'WorkOfflineDisabled' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": OfflineFiles/Pol_WorkOfflineDisabled_2
$k = 'HKLM:\Software\Policies\Microsoft\Windows\NetCache'
Remove-ItemProperty -Path $k -Name 'WorkOfflineDisabled' -ErrorAction SilentlyContinue