Reply
How to have Command Prompt control on remote network pc?
Old 01-03-2008, 09:24 PM How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
this has been bugging me i am sure there must be some way to do this.

How can i have command promt control on another pc on my network?

so i could have command promt open and instead of the commands affecting my pc it affects the other?

pref without the command box showing on the other PC, now i have seen soemthing similar when i first installed a webserver on my pc and has a bash/command script which ran commands and a friend shut down my pc...

so how can i do this without installing the large and annouying webserver on the other pc, or how could i write/obtain a small and hidden program to run and except the external commands in some way?
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
When You Register, These Ads Go Away!
     
Old 01-03-2008, 11:04 PM Re: How to have Command Prompt control on remote network pc?
beta's Avatar
Extreme Talker

Posts: 158
Location: Outside the car looking in at the keys
It sounds like you want a shell. It depends on what the other PC is running but you would need to have some kind of ssh service running and then connect from the other computer with something like: ssh username@computer

Then you would be given access depending on your user priveliges. To be honest i have no idea how it would be set up on a windows pc but im sure there is some software around.
beta is offline
Reply With Quote
View Public Profile
 
Old 01-03-2008, 11:58 PM Re: How to have Command Prompt control on remote network pc?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
On Windows, the most obvious answer is remote desktop, but I'm guessing that's not what you want. Probably a little too intensive...

There are a lot of software that give similar functionality. With SQL Server you can use a built-in extended stored procedure to run o/s commands on the host machine. That's also pretty resource intensive. I'm not sure of a specific one to do what you want, though.

You could write one yourself fairly easily. You can make a command window using a multi-line text box, then have it remote commands to a service - which you'll also have to write - running on the other machine. It'll simply take your commands and use System.Diagnostics.Process.Start to shell your commands.

What exactly are you trying to run on a remote box? If you right click 'My Computer' and hit Manage from the popup menu, it pulls MMC up. Go to the Action menu, and select the first option, 'Connect to Another Computer.' Honestly, it might be somewhere else on XP; I don't need to do this very often. It won't let you spawn arbitrary commands, but it'll give you a good deal of control over what's running on the other box.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-04-2008, 03:43 AM Re: How to have Command Prompt control on remote network pc?
tripy's Avatar
Fetchez la vache!

Posts: 1,822
Name: Thierry
Location: In the void
Quote:
To be honest i have no idea how it would be set up on a windows pc but im sure there is some software around.
The easiest way is to install a cygwin package set. [ http://www.cygwin.com/ ]
You can install the openSsh package and register it as a service on windows
[ http://pigtail.net/LRP/printsrv/cygwin-sshd.html ]
and once it's running, you simply use putty or any other ssh client to access your windows computer. I find the advantage of using cygwin rather that a simple ssh server is that you have a lot of useful linux commands available too, without needing a remote session
__________________
Listen to the ducky: "This is awesome!!!"

tripy is online now
Reply With Quote
View Public Profile
 
Old 01-04-2008, 09:51 AM Re: How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
Okay to clarify things.

Box(s) i want to access are Windows XP (home/media)

And my PC i want to access the FROM is Windows Vista Ultimate.

i am able to make a user account on both boxes which would be used to authenticate me, BUT whatever software must be reasonably well hidden and not show anything on desktop of taskbar.

I currently have no clue with linux CLI commands, as have never had a system properly working with it

i would like to have as much control as possible on the remote boxes, to be able to copy files, view files/dir trees, shutdown/logoff/restart basically most thibsg you can do with CMD just on the remote machine(s)

Has a look at Cygwin and looks a little confusing although i probably didnt read it properly.

Quote:
You could write one yourself fairly easily. You can make a command window using a multi-line text box, then have it remote commands to a service - which you'll also have to write - running on the other machine. It'll simply take your commands and use System.Diagnostics.Process.Start to shell your commands.
Now this would be something i would love to learn to do.

Do you know of any simple tutorials or could you explain further about how i coudl elarn to and go about writing a program to do this?

Thanks,
Dan
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 01-05-2008, 03:03 PM Re: How to have Command Prompt control on remote network pc?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
Quote:
Originally Posted by dansgalaxy View Post
Now this would be something i would love to learn to do.

Do you know of any simple tutorials or could you explain further about how i coudl elarn to and go about writing a program to do this?
Given the amount of control and stealth you need, and the fact that no one seems to know of a pre-made solution ... this might be your best bet.

What languages are you familiar with? I'd get whichever one of these you feel most comfortable in. They're free, and from a trusted source ... at least a semi trusted one. Any of the three will let you make a service to install into the background on the XP machine, and a client for your Vista remote control.

Here's a tutorial on writing a Windows Service. That's likely to be the most cumbersome part, especially since they need to be installed. But, once that's done, you can set it to start automatically with the operating system. But there's no user interface; no hidden window, no system tray, no alt tabbing. And the XP taskman doesn't show running services.

Here's another tutorial ... I'm going to quote a snippet here. This is the skeleton code for a Windows Service. You can add custom methods - and you'd need to make one - that take commands from clients, but this is the minimum:

Code:
 public class CronService : ServiceBase { 
  public CronService() {
    this.ServiceName = "Cron";
    this.CanStop = true;
    this.CanPauseAndContinue = false;
    this.AutoLog = true;
  } 


   protected override void OnStart(string [] args) {
    // do startup stuff
  }
 
  protected override void OnStop() {
   // do shutdown stuff
  }
 
  public static void Main() { 
   System.ServiceProcess.ServiceBase.Run(new CronService());
  }
}

Not bad, if you ask me.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-05-2008, 04:30 PM Re: How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
At the moment im not at home.

But i think i have installed the visual studio stuff (cross fingers)

i will have to look this up im assuming that code is VB?

Thanks will look at home and see what i can figure out.
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 01-05-2008, 08:37 PM Re: How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
okay just had a bit of a better look.

Sorry im very confused at the moment the only other time i have used VB was on a college taster and it was very well instructed so it was just copy and paste

Can you explain more im getting really confused on how to do this
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 01-06-2008, 12:08 AM Re: How to have Command Prompt control on remote network pc?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
Sure. The code above is C, but what you need to do in VB is very similar: make a service to take commands and execute them, and then make a client that takes your commands and sends them to the service.

In VB, make a new project. You should have some choices, like Windows Application, Console Application, Class Library, and others ... one of them is Windows Service. You'll have to handle a few basic events - when the service is paused, it shouldn't accept new commands - but that's pretty simple.

Then you'll make a method to actually execute the command. It'll look something like this:

Code:
Public Function ExecuteCommand(cmd As String, args As String) As String
Try
   System.Diagnostics.Process.Start(cmd, args)
Catch ex As Exception
   Return ex.Message
End Try
End Function
You might improve that a little ... you can have the command run in hidden mode and collect its output ... I haven't done this in a few months, but I'll dig up the code for that.

Finally, you'll make a client app that connects to the service, runs the commands you send, then shows you the output.

Here's a VB example:

http://www.developer.com/net/vb/article.php/3080731
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-06-2008, 07:11 AM Re: How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
okay on my Visual Basic 2008 Express edition.

it has:
Windows From Application
Class Library
WPF Application
WPF Web Application
Console Application

:s

I really wish i could get my head arround this kind of thing more easily.

I think i like know the idea i just cant fingure out how the hell to start with this
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 01-06-2008, 10:51 PM Re: How to have Command Prompt control on remote network pc?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
Hmm ... if it doesn't have Windows service as a project type, you could probably use a Windows Forms app, and just suppress the user interface. The trouble is, you can't connect to it in the same way.

You could use the file system, though. Your management client app could let you type in a command and any parameters, then save these on the other computer in an xml file. The hidden desktop app that could take the place of a service, can wait until a new file is created in that particular folder, then read the command, execute it, and write the results back to a new xml file your client would read back to tell you what happened.

The FileSystemWatcher class will tell you when a new file has been created.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-07-2008, 02:01 AM Re: How to have Command Prompt control on remote network pc?
dansgalaxy's Avatar
Eat, Sleep, Code

Latest Blog Post:
New College Enrollment.
Posts: 5,805
Name: Dan
Location: Swindon
it has something like service under the objects tab thing :s
__________________
Personal UK Webhosting
Get 25% of ANY shared package for life ~ Promo: webmaster-talk
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 01-08-2008, 01:30 AM Re: How to have Command Prompt control on remote network pc?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,025
Name: Forrest Croce
Location: Seattle, WA
The object browser? Or something else I'm not thinking of?
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-08-2008, 06:01 AM Re: How to have Command Prompt control on remote network pc?
chrishirst's Avatar
Super Moderator

Posts: 11,495
Location: Blackpool. UK
http://technet.microsoft.com/en-us/s.../bb896649.aspx

When I was a "wage slave" I used DameWare for remote management.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System