I am assisting with computers for a small private school. On each computer, I've created an admin account and a student account. The latter has almost no permissions to do anything. We lend these computers out to students when they need a computer to use for homework purposes, and I'm trying to figure out a way to quickly delete this account, then add it back in so it's just a clean install of that account with none of the previous user's history in it. I found I can delete the account in Powershell with:
Remove-LocalUser -Name "Student"
I've also found I can add the user with:
New-LocalUser -Name "Student" -NoPassword -UserMayNotChangePassword
I do not want this account to have a password on it, but I also do not want the user to put a password on it. But when I create it, the "User must change password at next logon" box is checked. I don't see a switch to uncheck that, and am curious if someone might know how to make that happen.
Also, if it helps, we're using Windows 10 Pro.
Old method is a way :) (be aware that WinNT moniker is case sensitive, so do not type it 'winnt' or whatever way)
New-LocalUser "Student" -NoPassword -UserMayNotChangePassword
# WinNT://. is for localhost, use WinNT://MyComp for remote computer
$locUser = [ADSI]"WinNT://./Student,User
$locUser.PasswordExpired = 0
$locUser.SetInfo()
# Optional, but by default passwords expire after 42 days,
# it can be done with WinNT, but easier to read like this
Set-LocalUser "Student" -PasswordNeverExpires $true