How can I change the check box where it says "Password does not expire" from unchecked to checked with out having to create a new user all over again.
This is what I have so far.
$Computer = [ADSI]"WinNT://$Env:COMPUTERNAME,Computer" $LocalAdmin = $Computer.Create("User", "Bob") $LocalAdmin.SetPassword("Passw0rd123") $LocalAdmin.SetInfo() $LocalAdmin.FullName = "Bob" $LocalAdmin.SetInfo() $LocalAdmin.UserFlags = 65536 # code for Password does not expire $LocalAdmin.SetInfo()
This code creates a user called Bob and checks the checkbox for "Password does not expire".
What if a user has their check box unchecked, how do I change it so it will be checked? Or vise-versa.