Cisco Switch – Reset/Recover Password

Sometimes there is a need to reset unknown password on Cisco switch, without loosing configuration. It is not possible on standard way, because – switch is not accessible  without this password. 

    1. Connect Switch to computer using console cable plugged on console cable
    2. Prepare software as Putty for communication to switch
    3. Hold the mode button located at the front of the switch on the left side
    4. Power off and then power on switch. Switches does not power button, so it should be done by unplugging and plugging power cable
    5. When characters appear on the screen release the mode button
    6. Press ctrl + pause/break on the keyboard. Use USB keyboard if laptop is in use
    7. Enter on switch flash and rename setup file, so it can not be find and loaded after restart, then restart
      Switch:flash_init 
      Switch:dir flash: 
      Switch:rename flash:config.text flash:config.backup 
      Switch:boot
    8. After switch restart and load IOS without settings,  rename back config files and disable passwords
      Would you like to enter the inital configuration dialog? no
      Switch > enable
      Switch#rename flash:config.backup config.text
      Switch#copy flash:config.text system:running-config
      Switch#config terminal
      Switch(config)#no enable secret.
      Switch(config)#exit
      Switch(config)#wr

Now new password can be set using standard procedure

More information you can find there