cmd - "runas" command executes successfully but desired output is not achieved -


i executing runas command in cmd create new user administrator , executing without giving errors user not getting created.

the command using runas /user:administrator "cmd /c net user /add username password"

your /user:administrator argument has wrong format.

it should in form:

/user:<administratoraccountname>@<computername> /user:<computername>\<administratoraccountname> /user:<administratoraccountname>@<domainname> /user:<domainname>\<administratoraccountname> 

source runas - execute program under different user account

syntax ...

 runas [ [/noprofile | /profile] [/env] [/savecred] ] /smartcard [/user:username] program 

...

key

...

/user username in form user@domain or domain\user 

...

example

runas /env /user:ss64dom\jdoe "mmc %windir%\system32\dsa.msc" 

see technet runas more information.


"i tried runas /profile /user:yogi\administrator "cmd net user /add username password" still not working

  1. you don't need cmd in there.

  2. the format of net user... command incorrect. /add should after username password

try following:

runas /profile /user:yogi\administrator "cmd net user username password /add" 

source net user

syntax

net user [<username> {<password> | *} [<options>]] [/domain] net user [<username> {<password> | *} /add [<options>] [/domain]] net user [<username> [/delete] [/domain]] 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -