Reply
Accepted Solution

scrip to remove username

abulail
Techie
Posts: 6
3366     0

I using the below script to remove a username from Cisco IOS device

Script-Filter:
 $vendor eq "Cisco"

########################################################################
Action:
 Add username
Action-Filter:
 $sysdescr like /IOS/

Action-Commands:
conf t
no username atstest
end

 

 

I am getting error the reason is if you try to remove the usernale manually, there is a warning from the device that the user need to hit return, is there anyway that I can include carriage return in the scripts

 

here is the error message I am getting

 

16:23:47  Action-Filter 
 16:23:47    Filter matches 
 16:23:47  
 $sysdescr like /IOS/ 
 16:23:47  Action-Commands 
 16:23:47    conf t 
 16:23:48    no username atstest 
 16:25:06   
*** Timeout waiting for device ***
 router(config)#xit 
                             ^ 
 % Invalid input detected at '^' marker. 
  
 router(config)# 

 

 

 

Re: scrip to remove username

Expert
Posts: 263
3367     0

Just add a new-line character to the command:

 

    no username atstest\r

 

Re: scrip to remove username

Adviser
Posts: 424
3367     0

Did you use exit?

 

16:23:47   Action-Filter   16:23:47      Filter matches   16:23:47     $sysdescr like /IOS/   16:23:47   Action-Commands   16:23:47      conf t   16:23:48      no username atstest   16:25:06     *** Timeout waiting for device *** router(config)#xit 

 

NetMRI does not like that also the command is incorrect 

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

Re: scrip to remove username

Adviser
Posts: 424
3367     0

Or what Marty said

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

Re: scrip to remove username

abulail
Techie
Posts: 6
3367     0

\r did worked thanks for the help

 

Re: scrip to remove username

Expert
Posts: 263
3367     0

"Did you use exit?"

 

Sif, I'm pretty sure that's from a built-in of the CCS execution.  I've seen this before when there's an unexpected prompt (e.g., confirm [y/n]).  If the script finishes normally, "exit" is sent to the device to end the session.  But somehow the "e" is consumed by the prompt input.

Showing results for 
Search instead for 
Do you mean 

Recommended for You