I had to generate passwords for 200 users and provide them to customer. Here is the easy formula to generate random writeable passwords (to use for first time logon).
How it works?
- Each character of password has its own definition, based on ASCII table random pickup.
- if you type “=CHAR(RANDBETWEEN(65,90))” to Excel Cell, it will pickup random character from ASCII table from positions 65 through 90 (capital letters).
- This has to be defined for each character in password
I needed to create password with 9 characters (some numbers and special character). I used formula with 4 digit number, which us defined as follows:
And random result is password:
Example of use in e-mail account creation:
$p = convertto-securestring "LfgE4071*" -Asplaintext -force New-Mailbox -Name anatolij -Alias anatolij -OrganizationalUnit domain.com/IT' -UserPrincipalName firstname.lastname@example.org -SamAccountName anatolij -FirstName Anatolij -LastName Stokurev -Password $p -ResetPasswordOnNextLogon $false -Database MDB19; set-mailbox anatolij -EmailAddressPolicyEnabled $false -CustomAttribute1 Test -Primarysmtpaddress email@example.com -Displayname "Stokurev, Anatolij"