Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Generate Random Password
 

Vbscript / General / Generate Random Password

This script generates a random alpha-numeric password of variable length. 

Use intUpperLimit = 126, intLowerLimit = 33 and remove the `If` conditional to include special characters.


intMaxLenth = 14
intMinLength = 7

Randomize  

intCharacters = Int(((intMaxLenth - intMinLength + 1) * Rnd) + intMaxLenth)  

intUpperLimit = 122
intLowerLimit = 48

For i = 1 to intCharacters

    Randomize

    intChar = Int(((intUpperLimit - intLowerLimit + 1) * Rnd) + intLowerLimit)  

 If (intChar < 58 OR intChar > 64) AND (intChar < 91 OR intChar > 96) Then
      strPassword = strPassword & Chr(intChar)
 End If
Next

Wscript.Echo strPassword





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
          - Check Remote Computer Disks
          - Encode Hardcoded Passwords
          - Generate Random Password
          - Get Machine Ip Address
          - Get Machine Ip Address From Name
          - Print All Files In A Folder
          - Run Chkdsk
          - Set All Network Adapters To Dhcp
          - Sql Server Query
          - Vbscript Logging Techniques
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers