Followers 0

# RUNWAIT hangs for SYSTEM.

## 5 posts in this topic

I have a script that runs fine when an administrator or non-administrator launches it. It has a single line:

runwait( @comspec & ' /c query session Bob >"' & @scriptdir & '\in.log"',@scriptdir)

The "Query Session Bob" command will tell if Bob is currently connected via a Remote Desktop session.

If I compile this script and launch it the in.log is generated quickly.

If I schedule the binary as an AT job, which is then picked up by the Scheduler and Run As the SYSTEM account, it will not output anything. In fact, Task Manager shows that it is just sitting there in memory. If I use SRVANY.exe and run the binary as a service(adjusted with a small while loop), same thing: it does not process or complete the RUNWAIT.

Query.exe is in SYSTEM32 and SYSTEM has near full permissions on it.

I have the same problem using "NET SESSION" under as SYSTEM. Here's the code:

runwait( @comspec & ' /c net session >"' & @scriptdir & '\out.log"',@scriptdir)

Run visually and an out.log is produced. Run it as an AT job or Service and it just sits in memory.

Is there some security setting that might cause this? Why doesn't it fail? How can the 'hang' be diagnosed?

Thanks.

Tim

##### Share on other sites

Hi.

I have a script that runs fine when an administrator or non-administrator launches it. It has a single line [using a @comspec /c call]

I have the same problem with the use of BLAT.EXE to send status emails depending what the results of my script is.

As you post this now I suspect that CMD.EXE called from Autoit might need a GUI to interact with?? I'll check in that direction next week...

A quick one would be "@comspec /c echo test > c:\test.txt" runned with AT as "SYSTEM".

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

##### Share on other sites

Got it! Somewhere and at some time a DENY rule was placed on CMD.EXE for SYSTEM. So, RUNWAIT( @COMSPEC & " /c "...) was failing because it was totally denied access.

So, here's the question: if the RUNWAIT is denied access, why does it not 'fail' normally with some sort of error code?

Thanks,

Tim

Hi.

I have the same problem with the use of BLAT.EXE to send status emails depending what the results of my script is.

As you post this now I suspect that CMD.EXE called from Autoit might need a GUI to interact with?? I'll check in that direction next week...

A quick one would be "@comspec /c echo test > c:\test.txt" runned with AT as "SYSTEM".

Regards, Rudi.

##### Share on other sites

Anyone from Hiddensoft able to speak to this problem? If a file(cmd.exe) has a DENY ACL set on it, a RUN( @comspec & " /c echo yes") will hang. Should it be better to return right away with a failure code?

Thanks.

##### Share on other sites

Bump.

Anyone from Hiddensoft able to speak to this problem? If a file(cmd.exe) has a DENY ACL set on it, a RUN( @comspec & " /c echo yes") will hang. Should it be better to return right away with a failure code?

Thanks.

Facing this problem, too, right now. Any ideas to avoid this problem? (Runwait with timeout...?)

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!