I have developed a GUI test framework that does integrationtesting of our company website on a scheduled basis. When something fails, it\'ll take a screenshot of the desktop
I think the problem may be that you're on the wrong WindowStation. Have a look at these articles;
Why does print screen in a Windows Service return a black image?
Screen capture from windows service
It could be that your win-station is dissappearing when you disconnect. Are you running the application when you log in and then trying to leave it running when you disconnect?
If so, does it still do it if you connect with "mstsc /admin
"? In other words, connecting to and running on the console session? If not, this might be a workaround.