LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plink/PuTTY works 30% of the time using System Exec.vi

Solved!
Go to solution

Python is certainly an option, but although I did work with Python in the past it certainly is not my first choice when I have to tackle something. Not because it is bad or anything but because integrating ANY hardware access library is generally a lot more work there than in LabVIEW. I understand that for someone who uses LabVIEW maybe twice a year that balance might look slightly different, but if I need to use DAQ, Vision or instrument control, that comes right out of the box with LabVIEW, but with Python, Lua, Visual Basic, .Net and many more I have to tinker with various things first for all of them. If you only have to deal with standard communication protocols and not with specific hardware interfaces, LabVIEW doesn't have as many advantages anymore and in some parts even lacks comparative functionality to some of them. Then familiarity with the tool at hand can really get the dominating factor and if you are a Python crack, it's natural to look there. But if you use Python equally infrequently I still doubt you would be more productive in it.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 21 of 25
(4,029 Views)

A solution (did some googling for other languages using plink): re-directing standard input from somewhere else and the issue seems to be resolved with system exec.

For example instead of:

    "plink.exe" -ssh user@host -pw "" <command>

which will give an error, use:

     echo <command> | plink.exe -ssh user@host -pw ""

or

   cmd /c echo | "plink.exe" -ssh user@host -pw "" <command>

plink_vi_snippet.png

 

For those curious about input/output redirection for windows command line: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr...

Message 22 of 25
(3,929 Views)

A few minor improvements. First, the working directory only applies after plink is called, so better to keep it the local directory. LabVIEW seems to find PLink in Programs without specifying the path. Second, there is the option to authenticate with a private key using the -I option (that's lowercase i). This VI searches for a putty key (.ppk) in the VI's directory and uses the first one it finds:

Capture.PNG

I use this to shut down my Raspberry Pi when exiting my data collection VI. I modify my sudoers file as explained here and pass the command "sudo poweroff". 

 

Message 23 of 25
(3,899 Views)

Hi jemandel,

Can you please provide VI in 2014 version?

 

Thanks,

Pankaj

0 Kudos
Message 24 of 25
(3,883 Views)

Sorry, don't have 2014 installed anymore. You can't implement it from the diagram?

 

Additional note - it seems to find Plink.exe installed from the new (0.70) PuTTY installer, but not 0.6x. Passing the full path to Plink should work in that case.

0 Kudos
Message 25 of 25
(3,877 Views)