Thursday, July 15, 2021

removing oconfig lines with a wildcard for cisco ios.. or replace?

have a dumb question.. trying to automate some password changes for a cisco switch and an annoying part is changing aaa authentication.

typical manual way to do it is to login, conf t, show running config, scroll down to aaa group server radius GROUPNAME, copy out the server x.x.x.x auth-port 1000 acct-port 1001 ENCRYPTEDPASSWORD lines, type exit, type no "pastehere".. then manually go back and type server x.x.x.x auth-port 1000 acct-port 1001 NEWPASSWORD with whatever the command is to encrypt the password

i wrote a script to change the admin passwords with invoke-ssh, and can navigate to the point to where im in the aaa group server radius configuration, but i am pretty shit at powershell and was wondering if there is a command to avoid having to type "no server x.x.x.x. auth-port encrypted password" and instead either type a command to replace the current lines that are already in there, or a way to wildcard the no command, such as "no server x.x.x.x.x auth-port * * * *

that would be 10x simpler than having to parse all of the ssh output to select the line for the "no" command.



No comments:

Post a Comment