Security is very important, especially when it comes to IT.
We’ve created a password generating script to assist in making sure we all use high security passwords.

Here is a simple script if you prefer to use a PowerShell based solution, under it you will find VBs version.

Powershell

$characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ'
$nonchar = '123456789!$%&?+#'
$length = 10  #The total length will be 12, the last two characters are nonchar.

# select random characters
$random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }
$random2 = 1..2 | ForEach-Object { Get-Random -Maximum $nonchar.length }

$private:ofs= "" 
$password = [String]$characters[$random] + [String]$nonchar[$random2]
return $password
}

VBs

strComplex = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#_-%&?"
strLength = 12
strTitle = "Random Password Generator"
 
inputBox "Password is:", strTitle, RandomizePassword(strLength)
 
Function Generate(RandomNumber)
 Randomize
 Generate = INT(RND()*RandomNumber)+1
End Function
 
Function RandomizePassword(strLength)
 RandomizePassword = ""
 RandomNumber = Len(strComplex)
 
 For x = 1 To strLength
 strNum = Generate(RandomNumber)
 strNext = Mid(strComplex,strNum,1)
 RandomizePassword = RandomizePassword & strNext
 Next
End Function