create a script on a windows box that retrieves data from the Linux box by executing cmds
How can i create a script on a windows box that retrieves data from the Linux box by executing cmds against the remote Linux box?
I have got putty and Plink on the win box but not sure how to fire the cmds from a script eg a bat file and get the results written back to a txt file on the win box.
Any ideas how i would do this for something simple like a grep or LS cmd for example?
You can use plink on the command line to execute remote commands. Put the remote commands in a file like:
ls
cd ~/some/directory
echo "whatever"
Then run plink:
C:\Program Files\Putty\plink.exe -ssh -l <username> -pw <password> <ip/url> -m \your\file\with\the\commands
To send the output of plink to a file:
(C:\Program Files\Putty\plink.exe -ssh -l <username> -pw <password> <ip/url> -m \your\file\with\the\commands) >> logfile.txt 2>>&1