The power saving feature “connected standby” of Windows 10 causes PCs to go offline from Teamviewer, so you can’t wake them up and connect/control them. But there is a trick that stops this behavior.
The Problem
Some of the Windows 10 PCs that I control via TeamViewer often looked like this in the TeamViewer interface:

When I looked into the event viewer I found this event in event viewer whenever the connections was lost:
- “The system is entering connected standby. Reason: Idle Timeout.”
- Event ID: 506
- Event Source: Microsoft-Windows-Kernel-Power

This event is an indication that the system is entering a partially power saving mode. The screen turns off when not being used but the machine is still active. It is also called “Modern Standby”. The PC will still get notifications, continue downloads and all active tasks will remain at work while saving power. Upon keyboard/mouse activity Modern Standby requires little to no time to be back on, compared to Sleep and Hibernate.
But unfortunately the Teamviewer connection is also put to sleep.
Solution
Just turn off connected standby by changing the registry key
HKLM\System\CurrentControlSet\Control\Power\CsEnabled
from 1 to 0.