Sign in to follow this  
Followers 0
autoguy100

Running Autoit Scripts Remotely

10 posts in this topic

Hi,

I am trying to execute my AutoIT Script in remote PC without Logging to remote PC, The script does not execute unless i am logged in remote PC via RDP. Is there any way to overcome this problem.

BTW i execute the scripts using PSEXEC from system internals.

Attached Simple script which opens notepad, type some text and saves the text file.

When I execute with the following command

psexec i d \\<REMTORE PC NAME> <AUTOITSCRIPTS.exe>

Along with this I tried MSTSC.exe /console.

I see a process id generated for my script in remote PC, but it does not create the text file. The moment i log in remote desktop i see Just Notepad is open as per first step in my script.

I am using WMIC to check process running in remote PC, I tried with WMIC same issue process id is generated but i don't see results.

Note: I am to create script to RDP to remote PC, I am not able to get focus in remote PC while entering password.

Attached Scripts.

Need help on this issue.

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("This is some text.")

WinClose("Untitled - Notepad")

WinWaitActive("Notepad", "The text in the Untitled file has changed")

Send("!y")

WinWaitActive("Save As","")

send("simple.txt")

send("!s")

I just created simple script to check so that i can execute other scripts.

Share this post


Link to post
Share on other sites



Hi,

I am trying to execute my AutoIT Script in remote PC without Logging to remote PC, The script does not execute unless i am logged in remote PC via RDP. Is there any way to overcome this problem.

BTW i execute the scripts using PSEXEC from system internals.

Attached Simple script which opens notepad, type some text and saves the text file.

When I execute with the following command

psexec i d \\<REMTORE PC NAME> <AUTOITSCRIPTS.exe>

Along with this I tried MSTSC.exe /console.

I see a process id generated for my script in remote PC, but it does not create the text file. The moment i log in remote desktop i see Just Notepad is open as per first step in my script.

I am using WMIC to check process running in remote PC, I tried with WMIC same issue process id is generated but i don't see results.

Note: I am to create script to RDP to remote PC, I am not able to get focus in remote PC while entering password.

Attached Scripts.

Need help on this issue.

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("This is some text.")

WinClose("Untitled - Notepad")

WinWaitActive("Notepad", "The text in the Untitled file has changed")

Send("!y")

WinWaitActive("Save As","")

send("simple.txt")

send("!s")

I just created simple script to check so that i can execute other scripts.

ok, let's think about this another way... you want to be able to connect to a remote machine, and execute programs without having to supply any credentials... now i'm not saying that YOU are trying to do anything wrong, but can you think of any operating systems that would allow something like that? would you use an operating system that did?

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

ok, let's think about this another way... you want to be able to connect to a remote machine, and execute programs without having to supply any credentials... now i'm not saying that YOU are trying to do anything wrong, but can you think of any operating systems that would allow something like that? would you use an operating system that did?

I used user name and password for remote PC

Psexec -u <USER>, -p< Password> -i -d \\<HOSTNAME> Autoit script name

I i don't use user name and password , i will get error process id will not be generated.

Share this post


Link to post
Share on other sites

Do a forum search for startup, and you can get a regwrite locaton that you can put the script so it immediatley run on the computers startup(after you logon)

then Ftp this script to the computer that you plan on remotley accessing, log on, then the scipt will start :)

i dunno if i misunderstood the question, but look into it.

Share this post


Link to post
Share on other sites

Hi,

Me too, I'm in the need of simulating some mouseklicks in a `silly` application that isn`t to be handled by keyboard.

This way, we must use the scriptstatemets winwait_ etc.

Because this application should work as a software-interface, we decided to run it on a remote-pc somewhere in the serverroom.

And there the `problem` starts, if you try it to do via RDP...

All commands using WinWait etc. can not be processed as soon you are disconnected from this pc.

There are 4 different ways you can be connected to a Remote-PC (in conjuction with RDP)...:

1. Way:

This is the way you will do it normaly...

2. Way:

You use the /console switch

3. Way:

The way 1 and 2 are `terminalsessions` in fact - this way you are not realy steering the PC remotly...

If you use a real remote-steering software as pc-anywhere etc. - then you are realy in the position of steering the PC... (and this is the only way, your AutoIt-Script will go on even you are disconnected from the PC (as far as I know)).

4. Way:

If you where connected by lets say PC-Anywhere and have started your script it can happen to you, that you will connect to that PC by RDP /concole mode the next time.

And thats very, very unlucky - because from this moment on, your script will stop as soon you will terminate this RDP session.

I tried to have my script detecting if it runs in a RDP-session.

I used the environement variables `sessionname` and `clientname` - but this doesn't work in case 4...

(in case 4, windows reports still a real console-mode in place of the `takeover-mode` of the PC-Anywhere steering...

This is true only, if you use the same windows-account in all cases...

(just for clearance)

How to detect case 4?

Thanks

Thomas

ps: hope you will understand my `english`...

Share this post


Link to post
Share on other sites

What is psexec

Psexec is a commandline utility from sysinternals.com that will let you execute a program remotely. :)

Share this post


Link to post
Share on other sites

Psexec is a commandline utility from sysinternals.com that will let you execute a program remotely. :)

...and that requires that you actually have rights to execute programs on that machine. If not, too bad!

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Hi,

I am trying to execute my AutoIT Script in remote PC without Logging to remote PC, The script does not execute unless i am logged in remote PC via RDP. Is there any way to overcome this problem.

BTW i execute the scripts using PSEXEC from system internals.

Attached Simple script which opens notepad, type some text and saves the text file.

When I execute with the following command

psexec i d \\<REMTORE PC NAME> <AUTOITSCRIPTS.exe>

Along with this I tried MSTSC.exe /console.

I see a process id generated for my script in remote PC, but it does not create the text file. The moment i log in remote desktop i see Just Notepad is open as per first step in my script.

I am using WMIC to check process running in remote PC, I tried with WMIC same issue process id is generated but i don't see results.

Note: I am to create script to RDP to remote PC, I am not able to get focus in remote PC while entering password.

Attached Scripts.

Need help on this issue.

Run("notepad.exe")

WinWaitActive("Untitled - Notepad")

Send("This is some text.")

WinClose("Untitled - Notepad")

WinWaitActive("Notepad", "The text in the Untitled file has changed")

Send("!y")

WinWaitActive("Save As","")

send("simple.txt")

send("!s")

I just created simple script to check so that i can execute other scripts.

I've had issues using the -d switch with PSEXEC. Also, the -i switch assumes that someone other than the SYSTEM account is logged on and that the session will be passed to that logged on user.

If there is no logged on user, you really cannot maximize the use of win* commands since there is not viewable window. you can definitely run scripts remotely (i do it all the time), but for interactive scripts, a user needs to be logged in.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

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  
Followers 0