runas /profile /user:administrator "cmd /c net user /add [username] [password]".
I used the above command to create a new user using administrator permissions. After I enter this command, it prompts me for the administrator's password and when I input the password it creates the new user.
But I don't want to manually sit and type in the password. Is it possible to automatically pass in the password when prompted?
I tried the following command, but it gives me an error.
echo abcd | runas /profile /user:administrator "cmd /c net user /add [username] here, abcd is the administrators password.
the error I get is:
C:\Users\pjs>echo abcd | runas /profile /user:administrator "cmd /c net user /add joe hello"
Enter the password for administrator:
Attempting to start cmd /c net user /add joe hello as user "administrator" ...
RUNAS ERROR: Unable to run - cmd /c net user /add joe hello 1326: The user name or password is incorrect.
Is there any other way to solve this.