473,800 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9470
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:Wi n32_Process")
errReturn = objWMIService.C reate _
("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***@removethi s.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 Asyncremoteclie nt.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 remoteasyncclie nt.exe
myself.

Do network apps not start via a remote process?

"Jani Järvinen [MVP]" <ja***@removeth is.dystopia.fiw rote in message
news:%2******** ********@TK2MSF TNGP06.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:Wi n32_Process")
errReturn = objWMIService.C reate _
("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***@removethi s.dystopia.fi
http://www.saunalahti.fi/janij/


Jan 11 '07 #3
"Billy Bob" <wh*@microsoft. comwrote in message
news:er******** ********@TK2MSF TNGP03.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
Asyncremoteclie nt.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
remoteasyncclie nt.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 "environmen t" 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
27499
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 purpose is to start a process remotely. The problem initially was that the perl script could not 'see' any mapped drives as it would alway return 'access denied' so I'm trying to not only rewrite the script but fix this problem and my idea was...
0
2378
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 - Processes tab). I need this process to be visible. I have searched for the answers but have come to the conclusion that it is either a) impossible or b) it is so easy that it is not documented !!! Usage: perl filename.pl exe_to_run.exe use...
1
2383
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 System.Diagnosis.Process.Start("notepad.exe"); But the problems is the application freezes for a couple of seconds till the application starts. Is there any way to start a process asynchronously, so that my application wouldn't freeze? Should I create a new...
4
1401
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 but I can't find how to start another process searching numerous sites. I know .NET has the Process object, can I use this to launch a process on the client side? If so how to I tell .NET that I want the process launched n the client side rather than...
1
2107
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. Instead, I just have a warning for security reasons and 2 buttons (Attach | Don't attach). Let me explain a bit... I have several web applications running on different servers. All servers are XP 2003 Servers with IIS 6. My applications runs in...
0
1210
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 error message:Unable to start remote debugging on the server. i have checked all permissions that need to be given to user and application but still facing the same problem. In visual studio 2005, i have also checked the remote debugging option but...
4
5496
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 Code of the application. The return value only tells me if the application started successfully. Is their a way to capture the final exit code of the application that is started remotely?
1
1972
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 somewhat generic. It shouldn't expect the remote process to print its pid. Thanks, Srini Unlimited freedom, unlimited storage. Get it now, on http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
1
2830
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: python-list@python.org
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.