passgen

passgen.js
// * JWJ0215 | 02/15/2022 * This will make your password for you... Change the output number below in the (makeid(xx))
 
function makeid(length) {
   var result           = '';
   var characters       = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$^*';
   var charactersLength = characters.length;
   for ( var i = 0; i < length; i++ ) {
      result += characters.charAt(Math.floor(Math.random() * charactersLength));
   }
   return result;
}
// Change the number below for length
console.log(makeid(12));

This can be ran using Node.js in your terminal, linking it to an HTML file inside a web browser, or by using a text editor extension like Code Runner in VS Code. It could also be ran in the ServiceNow Background Script Editor, or even a scheduled script.

  • passgen.txt
  • Last modified: 06/03/2026 06:18
  • by johnsonjohn