简体   繁体   English

通过PowerDP / cmd通过RDP登录终端服务器并执行命令

[英]Logon terminal server over RDP per powershell/cmd and execute commands

I have problems with the powershell and some ideas. 我对Powershell和一些想法有疑问。

I would boot a computer in a company network each day on 9 o'clock. 我每天都会在9点启动公司网络中的计算机。 For thats i must connect to the company terminal server. 为此,我必须连接到公司终端服务器。 After the wakeonlan i must connect on the terminal server per rdp to the client. 唤醒之后,我必须按照rdp在终端服务器上连接到客户端。

How I could do this? 我该怎么做?

I think I connect to the terminal server over RDP and execute the WOL command. 我想我通过RDP连接到终端服务器并执行WOL命令。 Then i execute the RDP connect command and connect to the client. 然后,我执行RDP connect命令并连接到客户端。 After five minutes i close the both RDP sessions. 五分钟后,我关闭了两个RDP会话。

I tried PsExec but thats only allowed in a local server directory. 我尝试了PsExec,但是那只允许在本地服务器目录中进行。

RDP is a graphical/interactive protocol/system. RDP是图形/交互式协议/系统。 Although it can be done, GUI automation isn't PowerShell's speciality. 尽管可以做到,但GUI自动化并不是PowerShell的专长。 Try looking into something like AutoIt . 尝试研究类似AutoIt的东西。

For RDP automation you could try something like this (keep the form hidden), but it's a bad solution and I'm not sure it even works anymore on newer versions of Windows. 对于RDP自动化,您可以尝试这样的操作 (将表单保持隐藏状态),但这是一个不好的解决方案,并且我不确定它甚至可以在新版本的Windows上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM