保持服务器屏幕可控制状态

@%windir%System32 scon.exe 0 /dest:console
@%windir%System32 scon.exe 1 /dest:console
@%windir%System32 scon.exe 2 /dest:console

2.关机失效的解决方案:
远程桌面mstsc远程登录虚拟机时,在虚拟机中新建文本文档,写入内容
 
@%windir%System32 scon.exe 0 /dest:console
@%windir%System32 scon.exe 1 /dest:console
@%windir%System32 scon.exe 2 /dest:console
 
将文本文档重新命名为‘Close_RDP’,并将后缀名改为‘.bat’,双击文件‘EnableCloseRDP.bat’关闭虚拟机,在虚拟机关闭后带有SendKey的脚本可以正常运行。
原文地址:https://www.cnblogs.com/lnd-blog/p/14844661.html