RandomPassword function can be used to create random passwords in PowerShell based environments. It accepts a password length and an optional pattern (full or partial). A random pattern will be created or added if not specified. You can use patterns to make sure that your passwords has a guaranteed password complexity.
# 8-char password with a random pattern
RandomPassword -length 8
# 12-char with a partial start pattern "ULNS":
# one uppercase, one lowercase, one numeric, one specific
# the last six pattern classes will be generated in random
RandomPassword -length 12 -pattern "ULNS"
# 10-char with a full pattern "LLLLSUUUUN":
# four lowercase, one special, four uppercase and one numeric
RandomPassword -length 10 -pattern "LLLLSUUUUN"