Length Check
Part of the PowerShell Basics section of Coddy's PowerShell journey. Lesson 22 of 28.
Challenge
EasyA password needs at least 8 characters. Add the length check under the lines you already have; keep everything you wrote so far.
- After the
Charactersline, printLength: OKwhen the password has 8 or more characters. - Otherwise print
Length: too short (need 8).
With the input Cat7, your script prints:
Password Checker
================
Password: Cat7
Characters: 4
Length: too short (need 8)Try it yourself
# Password Checker
Write-Output "Password Checker"
Write-Output "================"
$pw = Read-Host "Password"
Write-Output "Characters: $($pw.Length)"
All lessons in PowerShell Basics
5Project: Password Checker
Project OverviewLength Check