Change the putty code to get machine and user name from a file

HI,
I have parsed a file and stored all my machine name and user name in a list.

Now I want to change in the putty code such that the machine name and user name can be passed through calling that one by one from tht list through an object. Then pass it to the place the putty takes user name and machine name as input .

please help

Can I ask why you want to do this? If it's to connect without prompts, you can use the plink command line interface that is installed with putty. It allows you to open a connection using saved session entries and execute commands. This isn't exactly reading the connection info from a file, but it does work.

Just pass it along at the command line, eg

C:\> C:\Program Files\PuTTY\putty.exe user@host

Ahh, you are correct. I was thinking he didn't want to put in the user and password, but he does. That will work well. :b:

Actually , I need to connect to 37 machines one by one . So i want to do something like put all username and machine name in a file and pass it to putty as I want like :

  1. 12 Machines of a Daemontype 1* I have
  2. 12 Machine of Daemon type 2* I have
  3. 12 Machine of Daemon type 3* I have
  4. 1 machine of daemon type A i have

Now every machine have a differnt name and host pass is same for all, I manaully have to loging and at the crunch time i mistype the user name and machine name .

Now If some how I can make it easier like :

  1. Put every machine name and user name in a file in an order.

  2. parse the file and Collect it in a list.

  3. When I run the program then it prompts me like

  4. For which Daemon u want to open the putty
    Daemon type 11
    then the putty for that open only i need to give a password.

  5. If i want to open machines in a group the
    Daemon type 1* I need to pass and the complete gropu of 12 machines should open.

  6. I dnt know can i give the password else i will pass it to as well.

Sm time it become very difficult for me to open each and every machine one by one and someone satnding on my head to see the issue is handled or not.

may be u got what i wanted to convey ;). Thanks

This may sound like a lot of work, but after the initial setup you could be done. If you go into the Putty GUI and set up the connection information and save the session for each one to a unique name, then you could put a pline statement in a script for each session thereby connecting to each server.

I'm not sure if you can save the session information with just the host and username leaving the password field blank. If you can, then you can have your script ask for the password and save it to a variable and feed it into the command line with each pline.

Good luck

You can also arrange password-less logins for ssh with keys. There's examples for that all over the internet.

My suggestion is to use PuttyCM and organize your connections based on folders. Once you defined all connection you can right click on the folder and connect to all saved session.