Allow Remote Shell Access
Autoriser l’accès aux environnements distants
Explanation
This policy setting configures access to remote shells.
If you enable or do not configure this policy setting, new remote shell connections are accepted by the server.
If you set this policy to ‘disabled’, new remote shell connections are rejected by the server.
Ce paramètre de stratégie configure l’accès aux environnements distants.
Si vous activez ce paramètre de stratégie ou si vous ne le configurez pas, les nouvelles connexions d’environnement distant sont acceptées par le serveur.
Si vous désactivez ce paramètre de stratégie, les nouvelles connexions d’environnement distant sont rejetées par le serveur.
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\WinRM\Service\WinRS- Value name
AllowRemoteShellAccess
| 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: WindowsRemoteShell/AllowRemoteShellAccess
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WinRM\Service\WinRS'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AllowRemoteShellAccess' -Value 1 -Type DWordDisable
# Disable: WindowsRemoteShell/AllowRemoteShellAccess
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WinRM\Service\WinRS'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AllowRemoteShellAccess' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": WindowsRemoteShell/AllowRemoteShellAccess
$k = 'HKLM:\Software\Policies\Microsoft\Windows\WinRM\Service\WinRS'
Remove-ItemProperty -Path $k -Name 'AllowRemoteShellAccess' -ErrorAction SilentlyContinue