changing the user password in Runtime (SIMATIC WinCC V5/V6)
How can I change the password of the logged-in user in SIMATIC WinCC Runtime?
For this you can use the WinCC API function "PWGENChangePassword", which requires four parameters:
- User name
- Old password of the user
- New password of the user
- Pointer to an error structure
The return value of the function "TRUE" if the password change has been successful and "FALSE" if an error has occurred.
Before calling this function you have to set up a connection to the database. You can use the "PWGENConnect" function. This function requires the parameters "DataSourceName" of the project and a pointer to an error structure. If the connection to the database is set up successfully, the return value of the function is "TRUE", if not, "FALSE".
Once you have successfully changed the password you should clear down the connection to the database using the "PWGENDisconnect" function. This function requires a pointer to an error structure as parameter and after successful disconnection the return value is "TRUE", otherwise "FALSE".
When using this functionality, note the configuration of your system. In server-client/multiclient mode the password has to be changed on each station.
The download includes a WinCC project that uses the above-mentioned functions in a dialog box. Also implemented is a check of the user name, old password and new password.
This project has been created using "WinCC V5.0 SP2" and be used in WinCC up to V5.1.
This project has been created using "WinCC V5.0 SP2" and migrated for WinCC V6.0 SP2.
Copy the "pw_change.exe" or "pw_change_v6.exe" file into a separate directory and then start the file with a double-click. The WinCC project now unpacks with all the associated subdirectories. You can then use the WinCC Explorer to open and process the unpacked project. You have to change the computer name accordingly to activate the project.