Sign in to follow this  
Followers 0
YoungRacoon

AutoIT3 Script: remote execution with psexec.exe

15 posts in this topic

Hi.

I'm trying to run autoit script on remote machine (with psexec from SysInternals\PCTools). Here is how I do it:

1. On local machine, I run the following code (local.bat):

psexec.exe \\remotecomp -u remoteuser -p password -i c:\windows\remote.bat

2. The content of remote.bat located on remote machine:

"C:\Program Files\AutoIt3\autoit3.exe" C:\work\remotetest.au3

3. The content of remotetest.au3:

run ('cmd /c "compmgmt.msc"', @SystemDir, @SW_HIDE)

4. When I run my local.bat, I get the following error on my remote machine:

---------------------------

Microsoft Visual C++ Runtime Library

---------------------------

Runtime Error!

Program:

This application has requested the Runtime to terminate it in an unusual way.

Please contact the application's support team for more information.

---------------------------

OK

---------------------------

5. If my remotetest.au3 contained only this code, it would work fine:

MsgBox(0, "Test", "Hello world!")

It means, something wrong with

run ('cmd /c "compmgmt.msc"', @SystemDir, @SW_HIDE)

Any suggestions? Thanks in advance,

Share this post


Link to post
Share on other sites



What type of remote system? OS?


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

What type of remote system? OS?

Windows 2003 sp1.

Share this post


Link to post
Share on other sites

2. The content of remote.bat located on remote machine:

"C:\Program Files\AutoIt3\autoit3.exe" C:\work\remotetest.au3
I maybe wrong here but I you need to compile the au3 file into an exe file. From there you should not have any problems running it as long as your code has no errors in it.

RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!!

Share this post


Link to post
Share on other sites

I maybe wrong here but I you need to compile the au3 file into an exe file. From there you should not have any problems running it as long as your code has no errors in it.

Thanks for advice but it didn't help. I made it executable but I'm getting the same error...

Share this post


Link to post
Share on other sites

Have you tried psexec to a different PC for experience comparison?

Lar.


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What happens if you replace cmd with @Comspec?

you could also try @WindowsDir & "\system32\mmc.exe"

Edited by spudw2k

Share this post


Link to post
Share on other sites

I would read the help files about run, @ComSpec, and look at the examples they give. I was able to get it to work locally.


RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!!

Share this post


Link to post
Share on other sites

Have you tried psexec to a different PC for experience comparison?

Lar.

Yes, I tried with the same result. Does it work in your environment? I mean, remote execution, not local one. Thanks.

Share this post


Link to post
Share on other sites

What happens if you replace cmd with @Comspec?

you could also try @WindowsDir & "\system32\mmc.exe"

Thanks for advice. I tried the followin variants:

run (@COMSPEC & " /c" & 'compmgmt.msc', @SystemDir, @SW_HIDE)

and

run (@COMSPEC & " /c" &@WindowsDir & '\system32\mmc.exe', "", @SW_HIDE)

Same result. Did it work in your environment? I mean, remote execution, not local one.

Share this post


Link to post
Share on other sites

I would read the help files about run, @ComSpec, and look at the examples they give. I was able to get it to work locally.

Yes, I have been reading it. No problem to work locally. The main point is specified in the topic: remote execution. Did it work in your environment? Thanks.

Share this post


Link to post
Share on other sites

Guys, am I the only one with this problem? Is it possible to use Run() in AutoIT scripts that are executed remotely?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Share this post


Link to post
Share on other sites

It should. I've never had such a problem.

run(@COMSPEC & " /c " & @WindowsDir & "\system32\mmc.exe compmgnt.msc", "", @SW_HIDE)
Thanks for feedback. It works locally, but not remotely. Actially, it is clear now the reason is out of AutoIT scope. If I run this code on local machine:

psexec.exe \\remotecomp -u remoteuser -p password -i c:\windows\remote.bat

and remote.bat contain this string:

mmc.exe

then I have Runtime Error specified in the beginning of this topic. The same error is when I use beyondexecv2.exe instead of psexec.exe.

That's it :)

Share this post


Link to post
Share on other sites

Thanks for feedback. It works locally, but not remotely. Actially, it is clear now the reason is out of AutoIT scope. If I run this code on local machine:

psexec.exe \\remotecomp -u remoteuser -p password -i c:\windows\remote.bat

and remote.bat contain this string:

mmc.exe

then I have Runtime Error specified in the beginning of this topic. The same error is when I use beyondexecv2.exe instead of psexec.exe.

That's it :)

The problem disappeared when I got the last version of PsExec. Earlier, I used to work with older one (1.3).

PsExec v1.82

Thanks to all !

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