Jason86 Posted October 20, 2017 Share Posted October 20, 2017 Hi, I would like to automate Putty commands whereby it will select my saved telnet session (so open Putty Configuration and select session) and afterwards it will open the Putty-prompt and will do next commands: <Enter> ACCESS <Enter> 'UserName' <Enter> SET Priv <Enter> 'Password' <Enter> LOG PORT ALL <Enter> And close Putty Kind of new in AutoIT so all help is welcome ! Thanks in advance, Regards, Link to comment Share on other sites More sharing options...
SlackerAl Posted October 20, 2017 Share Posted October 20, 2017 You might want to check out plink.exe (command line putty) which works better for non-interactive telnet operations and can be run from a batch file. Jason86 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 20, 2017 Moderators Share Posted October 20, 2017 Agree that plink is probably your best bet. I do a lot in putty sessions for customers, and use the following as a framework: Local $sEXE = @MyDocumentsDir & "\PuTTY\PLINK.EXE" Local $sUser = " -l root" Local $sPass = " -pw Password1" Local $sCommand = " esxcli storage vmfs unmap -l " For ... ShellExecute($sEXE, " -ssh " & $aRange1[$a][1] & $sUser & $sPass & $sCommand & $aRange1[$a][0]) ; - Pulls datastores from excel range and runs vmfs unmap Next Jason86 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
SlackerAl Posted October 20, 2017 Share Posted October 20, 2017 Depending on your circumstances you may also want to look at using ssh keys rather than embedding your username/password (care where you put the private key!). Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Jason86 Posted October 20, 2017 Author Share Posted October 20, 2017 36 minutes ago, SlackerAl said: You might want to check out plink.exe (command line putty) which works better for non-interactive telnet operations and can be run from a batch file. so something like : putty.exe -load “session name” but how to start this session and run the commands ? :s Link to comment Share on other sites More sharing options...
SlackerAl Posted October 20, 2017 Share Posted October 20, 2017 Let me google that for you.... https://www.tecmint.com/ssh-passwordless-login-with-putty/ http://www.thegeekstuff.com/2017/05/putty-plink-examples/ https://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html Jason86 1 Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Jason86 Posted October 20, 2017 Author Share Posted October 20, 2017 13 minutes ago, SlackerAl said: Let me google that for you.... https://www.tecmint.com/ssh-passwordless-login-with-putty/ http://www.thegeekstuff.com/2017/05/putty-plink-examples/ https://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html Thanks SlackerAl , I found this on the net: \path\to\putty.exe -load "[Sessionname]" -l [user] -pw [password] -m C:\path\to\commands.txt and in commands.txt I'll put the commands mentioned here beneath : <Enter> ACCESS <Enter> 'UserName' <Enter> SET Priv <Enter> 'Password' <Enter> LOG PORT ALL <Enter> Thanks ! Zohar 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now