In working with Powershell by creating user accounts, may the invalid password exception, InvalidPasswordException error message appears.
New-LocalUser: An exception of type “Microsoft.PowerShell.Commands.InvalidPasswordException”.

Cause
The Local Group Policy for password complexity requirements do not match the input, or the minimum password length is not met. The Powershell error message invalid password exception appers.
Solution
Change Minimum Password Length
Set Minimum Password Length to increase or decrease the password length to the desired length.

In Local Group Policy (gpedit.msc), change the Minimum Password Length, 0 for no Minimum Password Length.
Example. creates a user account in the powershell
The following Powershell command creates a user account with a password from the one line command, useful for script processing.
New-LocalUser user1 -Password (ConvertTo-SecureString "8170af" -AsPlainText -Force) -FullName user1 -Description user1 -PasswordNeverExpires -UserMayNotChangePassword