PowerShell Commands InvalidPasswordException

0
(0)

When creating user accounts in PowerShell, the InvalidPasswordException error appears.

New-LocalUser: An exception of type “Microsoft.PowerShell.Commands.InvalidPasswordException”.

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.

Solution

Local Group Policy for password complexity requirements do not match the input, or the minimum password length is not met.

In Local Group Policy (gpedit.msc), change the Minimum Password Length, 0 for no Minimum Password Length.

Tip

The following PowerShell command creates a user account with a password from the same command line, useful for script processing.

New-LocalUser user1 -Password (ConvertTo-SecureString "8170af" -AsPlainText -Force) -FullName user1 -Description user1 -PasswordNeverExpires -UserMayNotChangePassword

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *