If you have lost the password and cannot go online with TIA Portal, you can use a SIMATIC Memory Card
Newer firmware versions (v4.5+) also include a specific option to reset confidential configuration data if that is the specific password you've lost. :
(SMC) to erase the internal load memory. Note: This method on the CPU.
when the password is lost generally requires a complete factory reset. This process will the existing program and data on the controller. There is no official "backdoor" to recover the program without the password. 1. The Standard Recovery Method (Transfer Card) The most reliable way to unlock an is by using a Siemens SIMATIC Memory Card (S7-1200/S7-1500 ) configured as a "Transfer" card .
If you have forgotten the password and have no backup program, factory reset is the only reliable, legal, and safe method supported by Siemens. Always keep backups outside the PLC.