James Alston
asked on
Using powershell automate logins to Cisco Switches over SSH with Plink
First I want to say that yes, I do know there are tools that already exist that can make this much easier. Unfortunately we don't have that option right now. It is coming in the future, but for now I am trying to get this to work
here is my script so far, pretty simple....
2..100 | % { plink "172.16.15.$_ "}
this is working good for me. This will hit switches in the range of 172.16.15.2 - 172.16.15.100. It allows me to login to our switches all in the PS window and rolls right to the next one in sequence when I type exit, instead of opening up a new putty session every time.
Is there a way I can add my username and password to this so that it automatically logs into the switch for me, versus having to type it in every time? The end goal is I want to add whatever config changes I want to make to the script and have powershell run through all of them and update the config.
here is my script so far, pretty simple....
2..100 | % { plink "172.16.15.$_ "}
this is working good for me. This will hit switches in the range of 172.16.15.2 - 172.16.15.100. It allows me to login to our switches all in the PS window and rolls right to the next one in sequence when I type exit, instead of opening up a new putty session every time.
Is there a way I can add my username and password to this so that it automatically logs into the switch for me, versus having to type it in every time? The end goal is I want to add whatever config changes I want to make to the script and have powershell run through all of them and update the config.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
https://www.experts-exchange.com/questions/29001099/Passing-Credentials-into-a-command-line.html
I recently created a PS script with UI for the credentials that will be asked once and used for several commands like the one you want.
Open in new window