Personnaliser le message des erreurs d’accès refusé
Vérifié avec Windows Server 2025 — mis à jour le 30 juillet 2026
Pris en charge sur : Au minimum Windows Server 2012, Windows 8 ou Windows RT
Chemin dans la console GPO
Configuration ordinateur\Modèles d'administration\Système\Assistance en cas d’accès refusé Description
Ce paramètre de stratégie définit le message que les utilisateurs voient s’afficher lorsqu’ils ne sont pas autorisés à accéder à un fichier ou un dossier. Vous pouvez personnaliser le message d’accès refusé pour y ajouter du texte et des liens supplémentaires. Vous pouvez également permettre aux utilisateurs d’envoyer un courrier électronique pour demander l’autorisation d’accéder au fichier ou au dossier dont l’accès leur a été refusé. Si vous activez ce paramètre de stratégie, les utilisateurs reçoivent un message d’accès refusé provenant des serveurs de fichiers sur lesquels ce paramètre de stratégie est appliqué. Si vous désactivez ce paramètre de stratégie, les utilisateurs voient s’afficher un message d’accès refusé qui ne propose aucune des fonctionnalités contrôlées par ce paramètre de stratégie, quelle que soit la configuration du serveur de fichiers. Si vous ne configurez pas ce paramètre de stratégie, les utilisateurs voient s’afficher un message d’accès refusé standard, à moins que le serveur de fichiers ne soit configuré de sorte à afficher le message d’accès refusé personnalisé. Par défaut, les utilisateurs voient le message d’accès refusé standard.
Registre
SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied Nom de valeur : Enabled
Activé : Enabled = 1
Désactivé : Enabled = 0
MDM / Intune (CSP)
./Device/Vendor/MSFT/Policy/Config/ADMX_srmfci/AccessDeniedConfiguration Documentation Microsoft Learn Données de correspondance : Microsoft Learn (CC BY 4.0)
Générateur d'exports
BETAConfigurez l'état, la portée et les options, puis générez les sorties .reg, PowerShell, Intune et SCCM — ou ajoutez le paramètre à une collection multi-paramètres.
Ces exports écrivent le registre — ce n'est pas une GPO managée. ⓘ
Fichier .reg
Windows Registry Editor Version 5.00
; Exported from gporais.com
; Policy: Personnaliser le message des erreurs d’accès refusé
; State: Enabled
; Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied]
"Enabled"=dword:00000001
"ErrorMessage"=hex(7):00,00
; REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
"EmailMessage"=hex(7):00,00
; REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
"AllowEmailRequests"=dword:00000000
"PutDataOwnerOnTo"=dword:00000001
"PutAdminOnTo"=dword:00000001
"IncludeDeviceClaims"=dword:00000001
"IncludeUserClaims"=dword:00000001
"GenerateLog"=dword:00000001
"AdditonalEmailTo"="" Autres formats (PowerShell, Intune, SCCM)
PowerShell
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'Enabled' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'ErrorMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'EmailMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'AllowEmailRequests' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'PutDataOwnerOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'PutAdminOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeDeviceClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeUserClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'GenerateLog' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'AdditonalEmailTo' -Value '' -Type String Intune XML
OMA-URI: ./Device/Vendor/MSFT/Policy/Config/ADMX_srmfci/AccessDeniedConfiguration
Data type: String
Value:
<enabled/>
<!-- ErrorMessageText: enter one value per line before copying this XML payload. -->
<!-- EmailMessageText: enter one value per line before copying this XML payload. -->
<data id="AllowEmailRequestsCheck" value="0"/>
<data id="PutDataOwnerOnToCheck" value="1"/>
<data id="PutAdminOnToCheck" value="1"/>
<data id="IncludeDeviceClaimsCheck" value="1"/>
<data id="IncludeUserClaimsCheck" value="1"/>
<data id="GenerateLogCheck" value="1"/>
<data id="AdditonalEmailToText" value=""/> Intune Remediation
# === Detection script ===
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
function Test-RegistryValue {
param(
[Parameter(Mandatory = $true)][string]$Path,
[Parameter(Mandatory = $true)][string]$Name,
[object]$Expected,
[ValidateSet('String', 'DWord', 'MultiString')][string]$Kind = 'String',
[switch]$Absent
)
try {
$item = Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction Stop
} catch {
return $Absent.IsPresent
}
if ($Absent.IsPresent) { return $false }
$actual = $item.$Name
if ($Kind -eq 'DWord') { return ([int64]$actual) -eq ([int64]$Expected) }
if ($Kind -eq 'MultiString') {
$actualValues = @($actual)
$expectedValues = @($Expected)
if ($actualValues.Count -ne $expectedValues.Count) { return $false }
for ($i = 0; $i -lt $expectedValues.Count; $i++) {
if ([string]$actualValues[$i] -ne [string]$expectedValues[$i]) { return $false }
}
return $true
}
return [string]$actual -eq [string]$Expected
}
$checks = @(
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'Enabled' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'ErrorMessage' -Expected @() -Kind MultiString)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'EmailMessage' -Expected @() -Kind MultiString)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'AllowEmailRequests' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'PutDataOwnerOnTo' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'PutAdminOnTo' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'IncludeDeviceClaims' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'IncludeUserClaims' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'GenerateLog' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'AdditonalEmailTo' -Expected '' -Kind String)
)
if ($checks -notcontains $false) {
Write-Output 'Compliant'
exit 0
}
Write-Output 'Non-compliant'
exit 1
# === Remediation script ===
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'Enabled' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'ErrorMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'EmailMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'AllowEmailRequests' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'PutDataOwnerOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'PutAdminOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeDeviceClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeUserClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'GenerateLog' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'AdditonalEmailTo' -Value '' -Type String Scripts SCCM
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
# SCCM Configuration Item guidance:
# Create a Configuration Item of type "Setting: Script".
# Discovery script: use the Detection script below.
# Remediation script: use the Remediation script below.
# Compliance rule: the Discovery script output equals 'Compliant'.
# === Detection script ===
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
function Test-RegistryValue {
param(
[Parameter(Mandatory = $true)][string]$Path,
[Parameter(Mandatory = $true)][string]$Name,
[object]$Expected,
[ValidateSet('String', 'DWord', 'MultiString')][string]$Kind = 'String',
[switch]$Absent
)
try {
$item = Get-ItemProperty -LiteralPath $Path -Name $Name -ErrorAction Stop
} catch {
return $Absent.IsPresent
}
if ($Absent.IsPresent) { return $false }
$actual = $item.$Name
if ($Kind -eq 'DWord') { return ([int64]$actual) -eq ([int64]$Expected) }
if ($Kind -eq 'MultiString') {
$actualValues = @($actual)
$expectedValues = @($Expected)
if ($actualValues.Count -ne $expectedValues.Count) { return $false }
for ($i = 0; $i -lt $expectedValues.Count; $i++) {
if ([string]$actualValues[$i] -ne [string]$expectedValues[$i]) { return $false }
}
return $true
}
return [string]$actual -eq [string]$Expected
}
$checks = @(
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'Enabled' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'ErrorMessage' -Expected @() -Kind MultiString)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'EmailMessage' -Expected @() -Kind MultiString)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'AllowEmailRequests' -Expected 0 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'PutDataOwnerOnTo' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'PutAdminOnTo' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'IncludeDeviceClaims' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'IncludeUserClaims' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'GenerateLog' -Expected 1 -Kind DWord)
(Test-RegistryValue -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied' -Name 'AdditonalEmailTo' -Expected '' -Kind String)
)
if ($checks -notcontains $false) {
Write-Output 'Compliant'
exit 0
}
Write-Output 'Non-compliant'
exit 1
# === Remediation script ===
# Exported from gporais.com
# Policy: Personnaliser le message des erreurs d’accès refusé
# State: Enabled
# Supported on: Au minimum Windows Server 2012, Windows 8 ou Windows RT
$path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\ADR\AccessDenied'
New-Item -Path $path -Force | Out-Null
Set-ItemProperty -Path $path -Name 'Enabled' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'ErrorMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'EmailMessage' -Value @() -Type MultiString
# REG_MULTI_SZ: one string per input line; edit in regedit if you need richer formatting.
Set-ItemProperty -Path $path -Name 'AllowEmailRequests' -Value 0 -Type DWord
Set-ItemProperty -Path $path -Name 'PutDataOwnerOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'PutAdminOnTo' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeDeviceClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'IncludeUserClaims' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'GenerateLog' -Value 1 -Type DWord
Set-ItemProperty -Path $path -Name 'AdditonalEmailTo' -Value '' -Type String Vous construisez une collection multi-paramètres ? Ajoutez ce paramètre et générez des exports combinés (.reg, PowerShell, GPO).