What is going wrong with this:
$pass= "kissa"+"koira"
$pw= ConvertTo-SecureString $pass -AsPlainText -Force
#Create local user
New-LocalUser -Name $username -Password $pw -UserMayNotChangePassword -AccountNeverExpires -PasswordNeverExpires
It creates a user, does not nag about anything. But when I try to login the password is not accepted.
Password should be kissakoira. This is of over simplified example, im trying to create a password with three variables, but even this simple joined string does not work. Its not password complexity as plain kissa or koira work, but not the joined string.
This seems to work:
$pw="kissa"+"koira"| ConvertTo-SecureString -AsPlainText -Force
#Create local user New-LocalUser -Name $username -Password $pw -UserMayNotChangePassword -AccountNeverExpires -PasswordNeverExpires