Connect to a terminal server and run an application

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi. Does anybody know if it is possible to connect to a terminal
server and run an application there? Specifically, I need to write a
C++ or C# code to connect to a terminal server and run something like
"xcopy source to destination" there. After the xcopy finishes I want
to close the connection.

Thank you.
 
You can specify this on your client 'Start the following program on
connection' or on the terminal server by changing the user's shell to this
command.
 
Is it the only method? I guess that I can use IMsTscAx to do it. Am I
right? But anyway I don't understand how to wait until the application
finishes. Suppose the code will look like this

MsTscAxClass objRDC = new MsTscAxClass();
objRDC.Server = "Server";
objRDC.UserName = "User";
objRDC.ClearTextPassword = "password";
objRDC.SecuredSettings.StartProgram = "app.exe";
objRDC.Connect();

It doesn't work. Can you point me on where I'm wrong? How to extend
this code to wait until the application finishes?
Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top