I've got a situation where i have one system running a master application that communicates with slave applets on other systems, problem is, i can't guarentee that the slave applets will be running, nor that an operator can physically utilize the system to start the applet (and I'm also assuming they don't know how to use Remote desktop, these are minimum wage test operators)
Is there an easy way to remotely launch an executeable on another system?
security is not a concern here as this is a closed network.
If you're on the same network and have access credentials (username+password) to the remote computer, then Mark Russinovich's PsExec is just the tool you need.
WMI is your friend. See the following article which covers starting processes locally and remotely using WMI:
How To: (Almost) Everything In WMI via C# Part 2: Processes (CodeProject)
Kev
You can use the Windows AT command to schedule tasks on a remote machine.
Any chance of converting the remote applets into Windows services? They can be configured to start when the system starts; to retry if they fail; and to notify someone if there are problems. They're quite trivial to create with Visual Studio.
here's a 2 step solution
Write a batch file to kick start
the application/service in the
context
Have the batch file on a
shared network path which can be
accessed from the machine would like
to launch the application/service.
Honestly, I would suggest the PsExec solution by Piskvor. But you can try out this as well ;)
another simple solution if you're not on the same network (accessing your home computer to run teamviewer for example) is to create a rule in Outlook (if you have it) whereas if you receive an email say from yourself, you can have it start an application if there are certain pieces of text in the message body or subject line, for example:
Create a mailbox rule:
Step 1 - Conditions: From & With specific words in the body (from being your mail address and the message body: Start Teamviewer
Step 2 - Start Application (browse to the location of the .exe you want to launch)
Step 3 - enable that bad boy!
Obviously, you have to have Outlook open and accepting incoming mail in order for this to work.
you can tailor this to your requirements, ie: if Start Teamviewer is too easy, you can put codes or passwords in there too, so when the email arrives, it'll read the message, recognise the info based on the rule, and launch the application. :)
Related
So far, I've found plenty of ways to send and receive files over a network (mostly from this site), but I haven't been able to find a tutorial on how to do one with no listening software on the receiving side.
Example:
I want to send a messagebox with the title Hello, and the body There.
Normally, I would write out MessageBox.Show("Hello","There");
However, I want to be able to send the MessageBox over a network.
How would I do this, keeping in mind that:
Neither of the computers have admin privileges
I'm using windows 7 on both computers
The receiving side wouldn't have listening software on it.
Thanks in advance for anyone who helps me with this problem.
EDIT: It doesn't HAVE to be a MessageBox, I could make a forum that looks like one.
It's like saying, "Can I force you to do what I tell you, even if you're not listening to what I'm saying?"
To which the answer is, obviously, no.
If the other guy isn't plannig to respond to what you're saying, then, well, he won't.
You can't do this with a MessageBox, as that would be a pretty big loophole.
If you were using Windows XP, you might be able to use the "net send" command from the command line (hence callable in some way from a C# program, or from a batch file; whatever floats your boat), depending on the configuration of the machines.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_send.mspx
There was an equivalent program called msg.exe in Windows Vista, but it was removed altogether in Windows Seven.
-
In short, not with Windows Seven no.
You can shell out and call PsExec from Sysinternals to both copy and then run a program on a remote machine on your network - the program could be a listener you write or it could just be a program that displays a message it was given on the command line. PsExec isn't doing anything you couldn't do by calling the Windows API & using RPC directly, but that's a lot of work :)
Privileges will probably be an issue. At the end of the day there's no way for a non-admin user, out of the box, to muck with another machine on the network. You'll need permissions to be relaxed - maybe using group policy? But if you have group policy in place, just install a listener using an .msi or a login script.
Are you able to provide more information on WHY you want to do this? Perhaps there's a better way of achieving the notification you're after.
It is Possible with the msg.exe tool included in windows.
use the command
Shell("cmd.exe /c msg * /SERVER:" & ipAddress & " " & deineNachricht)
If your PC doesn't have msg, download it from somewhere.
Try looking into the code of this project- it used the net send command line program to send messages to remote machines, although i'm not sure how your mileage will go without admin privileges:
http://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&ved=0CCcQFjAA&url=http%3A%2F%2Fwww.codeproject.com%2FArticles%2F9466%2FThe-NetSend-Plus-NET-C&ei=hNOhT6ewH82RiQe--eCNCQ&usg=AFQjCNHzAjhU7SU7kuPSCQBLElR5vb1sIg
Is there a way for a program to be executed without clicking on it? Is it possible for it to be executed the minute you receive the file?
I want to build a c# application that executes any file sent to the machine from another machine connected to it. I want to do this without remote desktop, so I would check a checkbox that says "execute when finished sending" and when it is received, it would execute the program. So I would essentially be able to remote desktop, without actually remote desktoping.
Thanks in advance
Do you realize what you are proposing? If this was possible, every machine out there would be infested with the nastiest viruses.
Why don't you build a server part that you leave running on your remote machine and then have it execute whatever your heart pleases.
There is a program out there (currently in Beta) called SkyNet that does this. You can drag and drop a URL or file onto one of your "Contacts" and (for a URL) it will open an new tab and navigate to that site on your friend's computer. For files, it automatically drops them on that person's desktop.
So it is definitely possible.
Perhaps you want to use secure shell. There are clients and servers for various platforms (you didn't specify) and you can run programs remotely. This is useful for e.g. automated testing.
We have several apps that run on a Windows 2003/2008 server. Some of these apps are Java JAR files that are kicked off with a Scheduled Task using a app.cmd file.
Others are "big ones" like SQL Server and IIS.
I'd like to write an app (or service, actually) that simply monitors those programs and sees if they are running or not.
This is a little beyond what I've done before. Oh, this needs to be written in C#.
I was thinking of some type of "heart beat" pattern so that every few minutes, I check if the thread is running (again, new advanced threading) and if so, send out an "All's OK" message (using SMTP or something).
Any tips where to get started?
Thanks for any suggestions.
You can use Process.GetProcesses():
Use this method to create an array of new Process components and associate them with all the process resources on the local computer.
You should probably handle each application on a case-by-case basis, for exaple although you could just check for the existance of the SQL Server process you would be better off running a query that (for example) checks for the existance of a given database in the server.
Similarly you could run a simple HTTP request against an IIS server to check to make sure that the permissions are set up correctly etc...
Obviously the way that you test your Java processes would depend on what they do, although you could still just check for to see if the process is running (be aware that if they are running as a service they may be running inside one of the svchost.exe processes - this doesn't apply to scheduled tasks though).
I'm trying to create some sort of remote application execution programs. The situation is that I have a script on a remote pc that I need to execute. Ideally I could do with being able to tell this remote pc to execute this script as though I was at it locally.
If possible it would be executable without the need to login to the pc (such as sending login details etc). I'm going for using .net c#.
The best code is code that you don't have to write yourself. Take a look at PSExec from Microsoft (SysInternals). Assuming that you have common credentials with the remote machine (either by virtue of a domain login or the same password and username), it should "Just Work".
Windows Management Instrumentation (WMI) allows you to do just that. If you need .NET bindings for it, they are in the System.Management namespace
I WOULD GO with what Rob or Daniel suggested, but if you want to do something dirty (don't) you could write a small service that you'd register on the remote PCs that would just watch for a specific trigger. For example, the service could periodically check a network drive for a file, a database for some parameters, etc.
But as I said previously, this is something I would do if I'd want something really temporary and wouldn't want to spend time to learn how to do it properly.
how can i command to run file.exe file from another computer in my domain with C#
I know System.Diagnostic.Process.Start but its starting in my computer.
How can i use it for "192.168.100.2" ip addressed computer for running an exe file from my comp with a command? I know TCP/Socket programming but else ?
PsExec, a part of PsTools, can do this for you.
If you don't need a UI for the .exe you can use WMI to start a process remotely. I haven't got code to do it here but this codeproject article looks like it would work.
one easy way is to have the remote computer listening to some kind of event, this could be message queues, remoting(port listening) , web services/http.
once it listen to the event the host computer will need to start the process itself, this will ensure security in the host computer since it will run under some local credentials and policies.
You may Share a folder containing the .exe on your computer within the domain and use telnet to get a command line on the other computer to run the program. Nothing specific to C#/.NET however.