Jump to content
Sign in to follow this  

Running autoIT scripts on a remote machine via ssh

Recommended Posts

Hello All,

I am new to AutoIT. I have been developing scripts the last 3 days to automate some manual tasks performed in my work. Tasks are mostly launching home grown GUIs, or tera term windows, enabling them, stopping them and such.

I have 3 windows boxes A,B,C where I have to run scripts aa,bb,cc.

The script aa runs correctly on windows box A, bb runs on bb and cc runs correctly on C.

I have a virtual machine D. I need to execute a script on D that will start the autoIT scripts on A, B, and C.

On machine D:

I tried

ssh user@machineA:/..../aa List of args

and nothing happens

Can someone please tell me if this is possible and if so what changes are needed to my environment ?

Share this post

Link to post
Share on other sites

If you're running a script on virtual machine D that will connect to Machines A,B and C you could just use 3 PSexec.exe commands in a batch script on machine D. PSexec can remotely and interactively launch commands on remote Windows machines if the conditions are right. You ought to just test it out and see if it works...

Here's a link to PSExec (both download and syntax help): http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

I'm curious about your ssh, do you have some kind of Windows Secure Shell Server installed on your Windows machines?

Share this post

Link to post
Share on other sites

Thanks MrMitchell.

I have cywin installed on all 4 Windows boxes and that provides sshd.

So to rephrase the issue:

what I am trying to do is execute an AutoIT script that starts and closes windows on a machine A from a different machine D.

So I have a perl script on machine D which executes the following line:

ssh use@A:/auto_it_script_aa

I was hoping that the script aa would do what it was supposed to on A.

However I don't see any activity on A.

When I login/remote desktop directly to A and run the script I see it manipulate the windows as it should.

I will download PSExec and see if that allows me to do what I need

Share this post

Link to post
Share on other sites

I have the same problem. I am using cygwin sshd (open ssh). psexec won't work for me, because I am doing my ssh command from a Linux machine. How can we relax the security on the Windows side so AutoIT can run the script? thanks

Share this post

Link to post
Share on other sites

This is an overly simplified explanation, so those who deal deep within Windows or Linux inner-workings, my apologies in advance.

GUI is handled a little differently in Windows than from Linux.

On a Linux machine, a GUI app is just like a console app, but interacts with the GUI system (like X), so starting an application from a text based system like SSH can work.

On a Windows system, there are very different headers for GUI enabled and text (console) apps.  Console apps do not know how to interact with the WIndows GUI, and must handle graphics entirely on their own (something very few programmers have done since early Win95 days) without the benefit of the Windows common controls.  Text based emulated environments like SSH deal in text (in encrypted form) only, and do not have access to the system's GUI.  Even GUI apps that communicate through SSH are sending console-like data through SSH, which then is utilized by the GUI application on the other end.  The apps themselves are GUI apps, and therefore are able to use the Windows common controls. An SSH daemon, from its origins, is a console application.  Therefore, trying to run a GUI app from SSH will not work.

Maybe not the best explanation in the world, but in a nutshell, you would be much better off launching remote GUI apps (including GUI enabled AutoIt scripts) using PSExec as MrMitchell suggested.

If that will not work, you could try compiling a script as a console script.  Since, once launched, is no longer confined to the SSH environment, you should then be able to have it launch your GUI enabled script.  I do not know if this solution will work, however, so I still recommend PSExec.

------ Edit ------

Another idea for you would be to write a script to run on your remote PCs that watches for MailSlot messages, and another for your PC to send the messages.  The remotes could then launch other scripts in their respective windows based on the messages you send them.

See MAILSLOTS by Trancexx

You will need to make sure that the remotes are only able to run a limited set of commands, so that you do not open them up for hacking by this.

Edited by willichan
Another idea

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...