Adding users to Windows via command line

net user <user> <password> /add

net user bob password

To add to administrators group

net localgroup administrators <user>/add

To allow remote desktop access

net localgroup "Remote Desktop Users" <user>/add

If the password isn’t supposed to expire use this:

WMIC USERACCOUNT WHERE "Name='<user>'" SET PasswordExpires=FALSE

example:

WMIC USERACCOUNT WHERE "Name='bob'" SET PasswordExpires=FALSE

Leave a Reply

Your email address will not be published.