Reputation: 43
I am trying to create an local account that automatically signs in when Windows loads. However, when signing in for the first time, the account is prompted to set a password. However, this account does not have a password set because of the -NoPassword
flag. This computer is not joined to any domains.
I tried setting the -PasswordNeverExpires
flag, but upon checking in lusrmgr.msc, the "User must set password on logon"
box is still checked.
New-LocalUser "testmode" -NoPassword -FullName "test user" -Description "test sign-in account" -AccountNeverExpires
Add-LocalGroupMember -Group "Users" -Member "testmode"
Automatically sign the account in without prompting to set a password
Upvotes: 4
Views: 9864
Reputation: 211
Try this please: Here you are first creating the user, then piping to set the properties of said user.
New-LocalUser -Name "testmode" -NoPassword -AccountNeverExpires -UserMayNotChangePassword -FullName "test user" -Description "test sign-in account" | Set-LocalUser -PasswordNeverExpires $true
It should yield this:
Upvotes: 6