From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

system exec with psexec

I have a batch file that needs to be executed on a remote computer. 

I can call psexec.exe using  the system exec vi and the the command executes remotely as expected.

The problem is that the system exec vi hangs if the Wait Until Completion is true.

I can set this to false but then I don't get the std out or std error so I can't do capture any error codes.

What is the labview vi waiting for that is preventing it from finishing? 

0 Kudos
Message 1 of 4
(2,563 Views)

Hi,

 

If your program normally exits as a MsDos program does the exec.vi should also stop.

 

What happens if you run your psexec.exe program in a MsDos environment ?

 

Kees

0 Kudos
Message 2 of 4
(2,481 Views)

Psexec is a Microsoft add-on utility that can copy an exeutible file to a remote machine and run it there. 

Not sure what you mean by DOS envoronment but when I run this from the Windows Start command or from a CMD window (using the -d option) it exits normally.

 

What I ended up doing is adding lines to the remotely executed batch file that capture standard out and standard error and save to a file on the network.  Then I can read that and search for "task complete" strings and/or errors.

 

Reseaching Psexec, I find that it outputs std error and std out in a strange way that causes similar issues when called from other languages. 

There are alternative programs out there that do not have these limitations.  (PowerShell, RemoteExec, and BeyondExec for example)

 

0 Kudos
Message 3 of 4
(2,473 Views)

Hi,

 

I think you have to be old to know what MsDos is  Smiley Wink

 

I had similar problem in the past and I used the same solution as you do. Capture the output in a file and check the file. Not the solution you want but it works.

Some programs exit in a strange way which are not handled by the exec.vi as you migth expect.

 

Kees

0 Kudos
Message 4 of 4
(2,457 Views)