I am trying to modify the remote windows host's screen resolution via SSH. Firstly, i use python to write a little script to change local desktop's resolution.
import win32api
dm = win32api.EnumDisplaySettings(None, 0)
dm.PelsHeight = 1024
dm.PelsWidth = 1280
win32api.ChangeDisplaySettings(dm, 0)
And then, use pyinstaller
to build it as standalone .exe
file, put the outputted file to remote host, and execute the tool via SSH.
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(remote_win_host_ip, username= host_user, password=host_pswd)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command('/cygdrive/e/test/change_screen_res.exe')
Meanwhile, i write a script to show the current resolution, and use it on remote host in the same way.
from win32api import GetSystemMetrics
print "width =", GetSystemMetrics (0)
print "height =",GetSystemMetrics (1)
However, I find that the resolution of remote host is always 1024*768
.
How can I modify the resolution?
Thanks