logo

NJP

OOB Passwords Setting and Generation Password

Import · Jul 01, 2022 · article

Password Setting and Generation

ServiceNow's San Diego version simplifies password creation for administrators. An out-of-the-box (OOB) script, included as part of the password policy, automates password generation. This eliminates the manual burden of creating secure passwords for each user.

var username = 'itil';

var password = SNC.PasswordPolicyEvaluator.generateUserPassword(username);
gs.print(password) // to view the password

var result = SNC.PasswordPolicyEvaluator.setUserPassword(username, password);

setUserPassword - This sets the password which is generated above and ticks the p*assword needs reset* field.

If there is any other script which is used to set the password then this additional line can help in validating if the generated pass is as per the policy. The script returns true/false

var isValid = SNC.PasswordPolicyEvaluator.isValidPwdPerPolicy('password string', '3054afe6737a3300616ca9843cf6a735'); // sysid of the password policy

sometimes the length of the password could be crazy. I've seen a generated pass with 77 char, In order to adjust the length of the passwords.

Go to Password Policy > Open the default > set max char to lower number (default 100)

View original source

https://www.servicenow.com/community/developer-articles/oob-passwords-setting-and-generation-password/ta-p/2299566