Jump to content

PSEXEC executing autoit exe


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...