Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically create and launch and RDP session (without gui)

Tags:

c++

c#

.net

windows

I'd like to know if there is a way to create and launch a Remote Desktop Session on a Windows Server programmatically.

I'm trying to make an automatic tool to create Local Users and then launch the associate RDP session. I've already made LocalUser creation and adding them to Remote Desktop Users (using net.exe). But I'm struck with the next step : create and launch user's rdp-session. I don't know how to handle this problem without having the Remote Desktop Client Gui.

I'm working on a Windows Server 2003 and I'm using VS2008 with .NET 3.5.

Regards.

like image 605
adun Avatar asked May 04 '10 16:05

adun


1 Answers

You can call mstsc.exe and pass parameters on the command line to tell it what to connect to.

mstsc.exe documentation on MSDN

like image 63
Josh Yeager Avatar answered Sep 17 '22 21:09

Josh Yeager