Jump to content
Piotr_Hodl

PSEXEC executing autoit exe

Recommended Posts

Piotr_Hodl

Hello guys,

 

I am using psexec to execute an autoit exe remotely.

My autoit script, in the end of the flow will do some "asserts", where I currently write the results to a log file.

So basically I will need to do some checks in order to validate the test, something like this:

if result > 3 then _logIt("yes")

Where:

Func _logIt($ErrorMessage)
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage)
EndFunc 

I have looked everywhere and I was not able to find something similar of what I am pretending.

My goal is:

From the original host that is executing the psexec, get the STDOUT of the remote autoit exec script execution.

Now I am currently writing to the file, but I wanted to write to STDOUT.

 

Taking the same  example, I would be able to see the "yes" string from my original machine executing psexec command.

 

Is this possible?

 

Thanks

Piotr

Share this post


Link to post
Share on other sites
Piotr_Hodl

Bumping for visibiliy.

 

Thanks

Share this post


Link to post
Share on other sites
AdmiralAlkex

Hello and Welcome to the forum!

Your question is how to write to STDOUT? Did you search the helpfile for STDOUT? Use ConsoleWrite() and note that part in the helpfile about compiling to CUI/console app.

  • Like 1

Share this post


Link to post
Share on other sites
Piotr_Hodl

Thanks Admiral,

 

Yes, basically I want to write to stdout, so I am able to catch the result of the test.

I indeed saw that option, but I cannot compile into console.

Not even when I compile it with:

 

#AutoIt3Wrapper_Change2CUI=y

I will make effort today to compile in console mode and let you know.

Thanks

Share this post


Link to post
Share on other sites
Piotr_Hodl

Nevermind.

I add to download back again the editor and now I am prompt with the compile option.

Weird, because I thought I add it but this one shows me more options.

Anyway, I was able to compile in CUI mode but only when I run the file in CMD I am able to get the STDOUT. Running with PSEXEC opens a new CMD window, that opens and closes to fast and does not redirect STDOUT to PSEXEC.

It looks that PSEXEC does not redirect STDOUT of the programs that execute.

Thanks anyway

Edited by Piotr_Hodl

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

×