I encountered this error when trying to update group policy on a remote machine. I kept getting disconnected and it’s very frustrating reconnecting after every gpupdate. I found this tweak that will resolve this issue.
When group policy is refreshed the policy settings are deleted and then reset. During this time the configuration on the remote machine is temporarily valid. Which then all sessions may be disconnected.
You can apply this setting via Group Policy or via command line:
New-Item -Type DWord -Path HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections -Value "0" -Force
REG ADD HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
Test-Path -Path HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections
REG QUERY HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server /v fDenyTSConnections