Cincinnati PowerShell User Group - December 2017
For December's PSUG, we've created a PowerShell puzzler for you. Unleash your creativity and see if you can solve the puzzle and pass all the included tests!
Write a PowerShell function that generates random complex passwords. Clone or download this repo and use the included PowerShell script to complete the challenge. The script includes an empty function named "New-Password" and the associated Pester unit tests to validate that the function works as intended. Your job is to fill out the body of the function until all the tests are passing. Note that there is more than one way to solve this puzzle, so there is no definite right answer. Bring in your solutions and we'll review them as a group.
- The passwords generated must be in the form a string
- The passwords generated must meet Active Directory complexity requirements and must include 3 out of 4 of these characters: lower-case letters upper-case letters numbers 0-9 or symbols
- Passwords must be at least 8 characters and no more than 64 characters
- the completed function must be able to output passwords of various lengths base on the value of the -Length parameter
- The completed function must be able to output one or more passwords based on the value of the -Count parameter
You'll need the latest version of Pester (4.1.0) from the PowerShell Gallery to run the unit tests. Earlier versions may work, but aren't guaranteed. If you don't have this, you can still solve the challenge, but won't be able to validate it with unit tests.