Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Greeting,

I should run mstsc.exe with admin privileges from the VB application and automatically start the connection to the server (VS2019, Visual Basic). I managed to do all this on my local computer using the AxMsTscAxNotSafeForScripting1 control, but I need that connection to start on the clients remote computer (same domain like mine computer). Can you help me?

What I have tried:

1. <- works on local computer
AxMsTscAxNotSafeForScripting1.Server = "my server name"
AxMsTscAxNotSafeForScripting1.Domain = "my domain"
AxMsTscAxNotSafeForScripting1.UserName = "my username"
AxMsTscAxNotSafeForScripting1.Connect()


2. <- works on local computer
Process.Start("Cmd.exe", "/C mstsc.exe /admin")
Posted
Updated 28-Aug-20 1:18am
v2

I would suggest after reading Solution 1, you not re-invent the wheel, but use Sysinternals (now Microsoft) psexec or a similar mechanism to start the (process) on the remote computer - PsExec - Windows Sysinternals | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
Member 14918613 28-Aug-20 7:59am    
Thanks Garth
This is exactly the same question you asked a week ago: How to execute mstsc on remote computer with VB app[^]

I don't know why you deleted it and reposted, but at a guess it's because you either didn't like the answer(s) you got or just wanted to "bump" it to the top of the list. Either way, that's rude: it's saying "my question is much more important that anyone else's", and if everybody did it nobody would ever get answered because all you'd ever get to see is idiots fighting for the top spot (and hopefully an answer).

Don't repost; don't delete questions: basically don't be rude towards volunteers you want help from, it really doesn't help you at all.
 
Share this answer
 
Comments
Member 14918613 28-Aug-20 7:59am    
you are wrong, I did not get any answer or solution, just the conclusion that it would be a security issue, which I think was written just for the sake of the author to increase the number of his entries and answers. For me, such an entry had no value. As more than a week has passed without an answer last night I decided to delete the question not to stand idle. But today I changed my mind and decided to try my luck one more time.
Dave Kreskowiak 28-Aug-20 9:59am    
Uh, no. It's actually a MASSIVE security risk.

You CAN launch a process on a remote machine, so long as you have admin credentials on that machine. The process you launch cannot display any UI, nor have to wait for input. The process will never show up on any desktop so user interaction is impossible.

To launch a remote process, you would have to use WMI and the "Win32_Process" class and it's Create method.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900