Prevent users from sharing files within their profile.
Empêcher les utilisateurs de partager des fichiers de leur profil
Explanation
This policy setting specifies whether users can share files within their profile. By default users are allowed to share files within their profile to other users on their network after an administrator opts in the computer. An administrator can opt in the computer by using the sharing wizard to share a file within their profile.
If you enable this policy setting, users cannot share files within their profile using the sharing wizard. Also, the sharing wizard cannot create a share at %root%\users and can only be used to create SMB shares on folders.
If you disable or don't configure this policy setting, users can share files out of their user profile after an administrator has opted in the computer.
Ce paramètre de stratégie indique si les utilisateurs peuvent partager des fichiers de leur profil. Par défaut, les utilisateurs sont autorisés à partager des fichiers de leur profil avec d’autres utilisateurs du réseau, une fois qu’un administrateur a donné son consentement pour l’ordinateur concerné. Un administrateur peut donner son consentement pour un ordinateur via l’Assistant approprié afin de permettre le partage des fichiers du profil d’un utilisateur.
Si vous activez ce paramètre de stratégie, les utilisateurs ne peuvent pas partager les fichiers de leur profil à l’aide de l’Assistant correspondant. Par ailleurs, l’Assistant utilisé ne peut pas créer de partage à l’emplacement %root%\users ; il permet uniquement de créer des partages SMB sur des dossiers.
Si vous désactivez ou ne configurez pas ce paramètre de stratégie, les utilisateurs peuvent partager des fichiers de leur profil utilisateur lorsqu’un administrateur a donné son consentement pour l’ordinateur concerné.
Registry
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer- Value name
NoInplaceSharing
| 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: Sharing/NoInplaceSharing
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'NoInplaceSharing' -Value 1 -Type DWordDisable
# Disable: Sharing/NoInplaceSharing
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'NoInplaceSharing' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": Sharing/NoInplaceSharing
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
Remove-ItemProperty -Path $k -Name 'NoInplaceSharing' -ErrorAction SilentlyContinue