问题
First of all sorry for the (maybe not so specific) title as it consists of multiple topics.
The issue atm i'm having is related to my test automation setup. It consists of a linux machine handling the BE + FE and starting of the test themselves. And a Windows Server 2008 (Terminal) to which i connect through RDP session and it's the place the actual tests are run. For automation purposes i use Ranorex.
First of all how i have the Win machine set up: As Ranorex is a GUI test automation tool it needs to have the components visible for the AUT (application under test) and for this reason you need to close the RPD client without closing the session itself otherwise the test will start failing.
For this i created a bat file with the following code:
%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console
And added a reg entry DWORD value under HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client
RemoteDesktop_SuppressWhenMinimized
with the value 2.
What this does is after running the bat file with admin rights it will close the RDP session but will still keep the terminal connection open to the Win Server machine allowing the tests to be run.
Now the issue on hand is that after closing the session safely the resolution that gets set for the left open session is 1024x768 while when RDP connection is open it is 1920x1200.
So finally the question which i haven't been able to answer myself: is it somehow possible to specify the resolution for the session that is kept open?
回答1:
Now the issue on hand is that after closing the session safely the resolution >that gets set for the left open session is 1024x768 while when RDP connection is >open it is 1920x1200.
I have noticed the same thing as well. From what I have been able to figure out, the machine you are remoting into needs to have the default resolution = 1920x1200 on the physical (or virtual) machine.
I have used VNC to work around this limitation - but the only info I was able to find to prevent that from changing was to have the default resolution the same on all machines.
Good luck!
回答2:
Only solution I found for me was to install some VNC software on the machine, connect to it, change the resolution (in my case as well to 1920x1200) since you can't do that from RDP and I don't have access to the real machine.
I also download the QRes.exe tool and add it to the path.
And finally create this script:
for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
%windir%\System32\tscon.exe %%s /dest:console
timeout 5
qres /X 1920 /Y 1080 /C 32
)
Create shortcut for it (set to run as administrator) and from now on you can connect via RDP (mstsc) but on leaving just click on the icon to the above script instead of just closing the RDP.
P.S.: Qres is set to 1920x1080 since it doesn't support 1920x1200 but in my case (Windows 10), the tests are still run in the resolution set from VNC -> 1920x1200 so it's OK.
回答3:
I had to deal with the similar issue. I resolved it by installing Dameware MiniRemote Control agent in the machine. Once you connect to it via Dameware Mini Remote Control application you can change the resolution which you can't in RDP. (RealVNC or similar ones might work as others suggested, I didn't try them)
Some solutions which didn't work for me
- QRes.exe /x:1920 /y:1200 http://qres.sourceforge.net/
- Windows Management Instrumentation (in-built) : wmic desktopmonitor create screenheight=1920, screenwidth=1200
- ChangeScreenResolution : http://tools.taubenkorb.at/change-screen-resolution/
- Persistent windows: http://www.ninjacrab.com/persistent-windows/
来源:https://stackoverflow.com/questions/35862217/screen-resolution-changes-for-the-remote-machine-after-safely-closing-the-rdp-se