0

I have a remote Azure VM that keeps logging me off after long periods of inactivity. I have a service that needs to be constantly running there so that is a problem.

So far I have the following:

Power:

Sleep and turn off display are set to Never

Group Policies [ Computer Configuration...\Session Time Limits] :

  • Time limit for disconn sessions -> Never
  • Time limit for active but idle RDS session -> never
  • End session when time limit is reached -> Disabled -Time limit for LogOff of RDS -> Disabled
  • Time limit for active RDS sessions -> never

In Registry Editor [Policies...\Terminal Settings]:

-MaxDisconnectTime = 0

-MaxIdleTime = 0

No luck, if I close the RDS connection, it loggs me off within the next ~24-48 hours, shutting down all running services. Any ideas?

5

1 Answer 1

0

Since you have already tried the group policy part, will suggest few additional ones

You can try enabling RDP keep-alive at the network level

REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "KeepAliveEnable" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "KeepAliveInterval" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "KeepAliveTimeout" /t REG_DWORD /d 60000 /f

Here the keep-alive interval is set to 60 seconds. You can increase it as long as your service needs to run

Apart from this you can disable user account auto-logoff

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "InactivityTimeoutSecs" /t REG_DWORD /d 0 /f

Restart the VM to apply the changes

enter image description here

As per the MS documentation- Remote Desktop disconnects frequently in Azure VM - Virtual Machines | Microsoft Learn

Below things are suggested. Check if you have tried them all

Check the turn off display setting enter image description here

This one you already tried

enter image description here

Modify the group policies accordingly under gpedit.msc

  • Set time limit for disconnected sessions- Enabled, set to Never
  • Set time limit for active but idle Remote Desktop Services sessions- Enabled, set to Never
  • End session when time limits are reached- Disabled

enter image description here

enter image description here

enter image description here

enter image description here

Configure keep-alive connection interval- turn it to Enabled, set it to 1

enter image description here

then disable session timeouts and enable keep-alive

REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxDisconnectionTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxIdleTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxConnectionTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "KeepAliveTimeout" /t REG_DWORD /d 1 /f

enter image description here

Update Local Security Policy under secpol.msc -> Local Policies > Security Options

enter image description here

This should fix your logout issue.

Reference

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.