AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Now for a really hard one - running a program remotely
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Fri Nov 10, 2006 6:31 am    Post subject: Now for a really hard one - running a program remotely Reply with quote

I've been doing basic AHK for a while now, and I think I just descovered a reason to venture into CallDll a second time, but I have no idea how I will do this task:

The task: Open a program over terminal server connection

The problem: The program knows that it's being started by a terminal client and refuses.

Failed attempts:
Windows Run As other user
Windows Task Scheduler
Code:

;Run this just before logging out of the terminal client
Sleep, 30000
Run, overSensitiveProgram.exe
ExitApp


I am able to start the program if I log into a program such as VNC or GoToMyPC, but then I have to log out again and go back through the terminal client to use the program.

Any crazy ideas? I'm thinking there might be a DLL I can call somewhere to start the program, or maybe some other way to convince it I'm not a remote user (even though I am)

Right now I'm tempted to go to the machine and run a script that watches for a file to be created, which is a flag to start the program. I'm running out of ways to be convoluted.

Thanks!
Back to top
View user's profile Send private message Visit poster's website
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Fri Nov 10, 2006 6:37 am    Post subject: Reply with quote

I think I have the perfect tool for you! Cool

http://www.autohotkey.com/forum/viewtopic.php?t=9938&highlight=psexec
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Fri Nov 10, 2006 6:49 am    Post subject: Reply with quote

This is a cool script, thanks!

The problem is that the remote computer and I are not on the same network, I am currently using an AHK script to open an SSH connection and tunnel remote desktop. It is also possible (read: certain) that I don't fully grasp how to use PSexec, and PSexecGUI.
Back to top
View user's profile Send private message Visit poster's website
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Fri Nov 10, 2006 7:20 am    Post subject: Reply with quote

Quote:
The problem is that the remote computer and I are not on the same network.


Then Im almost positive that that script wont work for you.

So are you trying to get AHK to lauch the application that you use to make the ssh connection and then log you in and then run a command?
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Fri Nov 10, 2006 7:25 am    Post subject: Reply with quote

I already have a script that launches the connection. But once I am logged in to the remote computer, I want to start an application. (The computer is my number cruncher, and I am trying to start a calculation program). The calculation program does not allow people to start it over a remote desktop connection, but will let me use it if it's already running. I'm trying to start it remotely through the remote desktop or any other means, so that if I need to reboot while i'm away (say at a conference), I can still do my work.

Thanks for the other script, though, it looks pretty useful in general.
Back to top
View user's profile Send private message Visit poster's website
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Fri Nov 10, 2006 7:35 am    Post subject: Reply with quote

So for some reason this calc app. wont let you start it remotely, but if its already running you can access it and use it. Hmmmm.... Im not sure if this would work, but what if you created a local .AHK script on that machine and then ran the .AHK script remotely to start the calc app. I wonder if that would work. Confused Or am I totally confused? Shocked Laughing
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Fri Nov 10, 2006 7:42 am    Post subject: Reply with quote

You are not confused, that is exactly what I want. The problem is that the program knows that the autohotkey script was run by the remote user, and the script runs the program as the same user that ran the script.

I've even tried running a script with a delay, logging out, and logging in again, only to discover the same error message about not allowing remote users!

It's quite frustrating.
Back to top
View user's profile Send private message Visit poster's website
aCkRiTe



Joined: 21 Jul 2006
Posts: 502

PostPosted: Fri Nov 10, 2006 7:51 am    Post subject: Reply with quote

Wow! What kind of app. is this beast! Evil or Very Mad

and you said that the 'RunAs' command wont even work....
Im not sure what else you can try, sounds like you have tried almost everything you can... If I can think of anything else I'll let you know or maybe some others will have some nifty ideas. Good luck with the beast! Laughing
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Fri Nov 10, 2006 11:31 am    Post subject: Reply with quote

OKE, this is what you gonna do

Create an AHK script to launch the beast.
Make this ahk script a service. You can communicate with it via WM.
You can make it a service, for instance, using Basta AppToService console tool (its shareware but you can test it for 30 days to see if this works)
On connection you rise 2nd AHK script that will order the AHK service to launch the app. AHK service will run as a SYSTEM user so your beast Calc will never know what got it. Muhaha haaa h Twisted Evil
_________________
Back to top
View user's profile Send private message MSN Messenger
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Fri Nov 10, 2006 3:58 pm    Post subject: Reply with quote

I had not thought of making a service - I already have a Free program that does that, maybe others are interested: XYNTservice (Sorry no link)

I might try that tonight
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Fri Nov 10, 2006 4:40 pm    Post subject: Reply with quote

Thank you eng.

They are all free too me....
_________________
Back to top
View user's profile Send private message MSN Messenger
Lemming



Joined: 20 Dec 2005
Posts: 150
Location: Malaysia

PostPosted: Fri Nov 10, 2006 6:27 pm    Post subject: It's Terminal Services Reply with quote

I believe this is a side effect of running Terminal Services, and also, Remote Desktop (for Win XP).

When you login with the Terminal Services Client, the remote computer is set to "locked" mode to prevent idiots on the remote side from messing with your PC.

Unfortunately, there are programs which just refuse to run when a PC is locked. Your app sounds like one of 'em. The fact that you can run the app while using VNC and GoToMyPC seems to confirm this; they don't have a "locked PC" mode.

Is there some reason for not continuing to use VNC ? I mean, you're already tunnelling via SSH, so it should be secure. And if you're worried about the "idiots on the remote side" problem, most versions of VNC can be set to blank the screen and lock the keyboard/mouse when you connect.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 5957
Location: Pacific Northwest, US

PostPosted: Sat Nov 11, 2006 2:19 am    Post subject: Reply with quote

Actually, I have a modified version of the terminal server that allows me to log into the PC, and does not lock it. If someone else is using it, they can keep using it (I can't even tell what apps they have open). I can set as many concurrent connections as I want. The reason I don't want to use VNC or others is speed. Remote desktop is WAY faster, since it uses my computer to render all the UI stuff (IF I remember right, anyway), and only needs to transmit custom controls. So now effectively it's like a unix box with multiple logins and an X server, just running on windows =-)

When I get home tonight, I'll try making a service that can start the program.

@Chris: A) Does autohotkey have a way of detecting it's on a terminal server login?

B) Can autohotkey run things when I'm on the Welcome screen

Thanks!
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10450

PostPosted: Mon Nov 13, 2006 1:55 am    Post subject: Reply with quote

I don't have a lot of experience in those areas. However, I think there are some posts on the forum about them.
Back to top
View user's profile Send private message Send e-mail
emirvisir (not logged in)
Guest





PostPosted: Thu Dec 07, 2006 7:00 pm    Post subject: Reply with quote

For me the only issue is that Autohotkey does not seem to be able to see the windows inside a Terminal Server Window.

You must always set the "local ressources - send keyboard shortcuts to local computer". There are specially defined shortcuts for some functions in TS (cycle windows, screenshot, CTRL Alt Del in remote computer only)...

If I could do a controlsend in a TS I'd be very happy.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group