We will achieve this by using PSExec tool (download it here: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec).

#Navigate to PSTools folder
cd Downloads\PSTools

#Connect to the target computer (change ComputerName> and <username>)
#cmd is the command to run o the target computer. In our case we will run Command Prompt
psexec \\<ComputerName> -h -u username cmd

#Create the new user
net user "new_username" new_password /add /passwordreq:yes /fullname:"Firstname Lastname" /PASSWORDCHG:NO

#Set password to "never expires"
WMIC USERACCOUNT WHERE Name='new_username' SET PasswordExpires=FALSE

#Add the newly created user to the Local Administrator group
net localgroup Administrators "new_username" /add

That’s all!

Leave a Reply