Click here to Skip to main content
15,885,213 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi team, I have created a window app using VisualStudio. I need to start that application on several remote computer. That app is stored on a shared network drive and all the computers have access to it. Now, I am looking to write a .net app (C# or VB) to start such app. I have tried with psexec and it is working but the app starts on the background. I need to have that app on the foreground so the user on the remote computer can see the app on its desktop and interact with them. The below code does not work either. How I could achieve that?; Any clue? Thanks

What I have tried:

var connection = new ConnectionOptions();            
 connection.Username = @"xxxx";
 connection.Password = "zzzzzz";

 object[] theProcessToRun = { @"\\pcsupp\Applications\GetComputerLocation.exe" };            

 var wmiScope = new ManagementScope($@"\\TDS68924-EPIC\root\cimv2", connection);
 wmiScope.Connect();
 using (var managementClass = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions()))
            {               
                managementClass.InvokeMethod("Create", theProcessToRun);
           }
Posted
Updated 19-May-20 9:35am
v2
Comments
ZurdoDev 19-May-20 14:36pm    
The easiest way is to put a shortcut on each person's desktop and tell them to double-click it.
Member 14765571 19-May-20 14:46pm    
Ok, that would work.......however, we do not know where the computers are located and they are autologin computer. The windows app will prompt the user to enter some location info

You can't. For security reasons, you cannot start an interactive process on a remote machine.

Well, you can, its just that the user logged into the machine will never see any user interface for the app.
 
Share this answer
 
Comments
Member 14765571 20-May-20 7:37am    
Wow, that will be a problem. Thanks Dave. Could you let me know what are those security reasons? :)
Is there any way to work around it........maybe scripting?
Thanks!
Dave Kreskowiak 20-May-20 9:04am    
You can't do this because of the prevalence of malware.

Why does everyone who tries to do this think there's a way around a security feature? That would completely defeat the purpose of the security feature, wouldn't it?
PsExec[^] would allow you to do this a little less painfully.
 
Share this answer
 
Comments
Member 14765571 19-May-20 15:11pm    
I have tried psexec but the app start on the background. I needed on the foreground to allow the user to see the displayed prompt from the app :(
phil.o 19-May-20 15:13pm    
You can use the -i switch so that it can interact with the desktop.
Member 14765571 19-May-20 15:16pm    
Yes, I am also using -i and -d. Nothing :(
phil.o 19-May-20 15:26pm    
Try to provide a session id to the -i switch (eg., -i 1).

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