A
A
Andrey2018-11-04 22:58:59
Python
Andrey, 2018-11-04 22:58:59

How to connect to RDP in Python 3?

How to connect to a remote RDP server on windows on a non-default port and execute a cmd command from python'a?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pfg21, 2018-11-04
@pfg21

Может проще поставить на целевой стороне ssh сервер ??

V
Vladislav Klimanov, 2018-11-04
@ahmpro

Для RDP есть https://github.com/citronneur/rdpy
но лучше посмотрите в сторону https://github.com/diyan/pywinrm/

S
Sad Dosuna, 2018-11-05
@DemnNoble

Read about the Os module for Python, maybe it will help.

A
Artem @Jump, 2018-11-06
curated by the

How to connect to a remote RDP server on windows

It 's trite to execute a command mstsc.exe ConnectionFile | /v:ServerName[:Port]
The language in which you implement this is not important at all, even Python, even 1s.
and run cmd command from python?
It's already more difficult. RDP is a remote desktop protocol and does not allow commands to be executed on a remote computer.
You can execute a command in such a situation only by emulating user actions in an open remote desktop window.
Therefore, if you need to execute a command, it is better to look towards other protocols than RDP.
If you would describe the task in more detail and why it is needed, it is quite possible to come up with more or less adequate options for solving the problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question