If the IP address is known and "Full Access" is still available, use the "Online & Diagnostics" tool to perform a Factory Reset.
After recovering access, implement these best practices:
On modern CPUs, the process is handled through the TIA Portal software: