473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Start a Remote Process

Hello

In C# how can i start a remote process such as someapp.exe on a remote PC?
I know the remote PC's name, but how do I start the app on that PC?

Thanks
..
Jan 9 '07 #1
3 9435
Hi Billy,
In C# how can i start a remote process such as someapp.exe on a remote PC?
Well, I don't have C# code ready-made, but I think using WMI is the best bet
for starting processes on remote machines. I found some WMI scripts from
TechNet, this one is supposed to start "calc.exe" on a remote machine called
"atl-ws-01":

-----------------
strComputer = "atl-ws-01"
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("calc.exe", Null, Null, intProcessID)
-----------------

Maybe you could translate this into C# WMI code quite easily.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/
Jan 9 '07 #2
Hi

I tried that and it does start the process, but there is one problem with
it. I've downloaded this code from MSDN and it works
.....http://msdn2.microsoft.com/en-us/lib...97(VS.71).aspx but
wanting to start the Asyncremoteclient.exe on the remote machine, so I tried
that via the WMI script but for some reason, even though the app starts and
appears in taskman it never communicates with the server.exe unless I
manually go to the remote client pc and type in remoteasyncclient.exe
myself.

Do network apps not start via a remote process?

"Jani Järvinen [MVP]" <ja***@removethis.dystopia.fiwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi Billy,
>In C# how can i start a remote process such as someapp.exe on a remote
PC?

Well, I don't have C# code ready-made, but I think using WMI is the best
bet for starting processes on remote machines. I found some WMI scripts
from TechNet, this one is supposed to start "calc.exe" on a remote machine
called "atl-ws-01":

-----------------
strComputer = "atl-ws-01"
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create _
("calc.exe", Null, Null, intProcessID)
-----------------

Maybe you could translate this into C# WMI code quite easily.

--
Regards,

Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi
http://www.saunalahti.fi/janij/


Jan 11 '07 #3
"Billy Bob" <wh*@microsoft.comwrote in message
news:er****************@TK2MSFTNGP03.phx.gbl...
Hi

I tried that and it does start the process, but there is one problem with it. I've
downloaded this code from MSDN and it works
....http://msdn2.microsoft.com/en-us/lib...97(VS.71).aspx but wanting to start the
Asyncremoteclient.exe on the remote machine, so I tried that via the WMI script but for
some reason, even though the app starts and appears in taskman it never communicates with
the server.exe unless I manually go to the remote client pc and type in
remoteasyncclient.exe myself.

Do network apps not start via a remote process?
What you are trying does not work in general on Windows. The remote process runs in a
restricted security context, it does not run in the context of an interactive logon account
(if any), it runs in the security context of the remote WMI service and by default it's
impersonating the initiator (the WMI client). What does it mean to the application that was
started? First, this application has no way to interact with the user, even when it's a
console application, the output will go to a non visible desktop and there is no way to read
from the keyboard. Second, the "environment" is the one inherited from the Service that
launched the program, that means that variables like the home directory and current working
directory are not what you might expect, the profile loaded is not a user profile but a
service profile, so applications who expect this profile to be loaded will fail miserably.
Or otherwise stated, what you are trying is a no no in Windows, all you can do is use Remote
Destop or Terminal Services to start a remote interactive session and launch your
application from the command windows.

Willy.

Jan 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sean | last post by:
I can connect to a machine remotely with no problems but I'm having trouble trying to create a process remotely. Initially this was a perl and VB script which I'm converting to python. Its entire...
0
by: Mark Elley | last post by:
I am using the following code to start a process on a networked XP machine. This all works really well but the process created is invisible to the user (only visible in the Task Manager -...
1
by: Sin Jeong-hun | last post by:
Many applications need to lanch a web browser to show its homepage to users. I used System.Diagnosis.Process.Start("http://www.google.com"); Or I launched other application like...
4
by: Steven Brooks | last post by:
Hi guys A have an ASPX page (a main menu) and from it I need to launch existing exes on the local PC that has invoked the page from IE. I'm thinking that I would have to do this via JavaScript...
1
by: Martin Simard | last post by:
Hi all, In VS 2003, when I attach to a remote process for debugging, I can see the list of modules loaded by the process before attaching to it. This list is not there anymore in VS 2005....
0
by: Amit | last post by:
In .net 2.0 i have deployed my web application on the remote server with application code. when i am running that application from my local machine through mapping to that server i am getting an...
4
by: =?Utf-8?B?U3VyZXNoIE5hZ2FyYWphbg==?= | last post by:
Hello, I am trying to execute an application on a remote system. After checking several of the website I was managed to write a C# application do the same. But I am not able to track the Exit...
1
by: srinivasan srinivas | last post by:
Hi, Could you please suggest me a way to find pid of a process started on a remote machine by the current process?? I should get pid in the current process environment. The approach should be...
1
by: srinivasan srinivas | last post by:
HI, I am using Solaris and subprocess.Popen to spawn a process on a remote machine. Thanks, Srini ----- Original Message ---- From:Diez B. Roggisch <deets@nospam.web.de> To:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.