I need to send some commands as system admin throught PHP system()
function on Windows environment.
I know that it can be dangerous, but I need that.
I have solved this issue by using a toolkit named cpau
By using it I can exec command very simply:
cpau -u administrator -p PWD_HERE -LWP -ex "net user myuser mypwd /add"
To make this work I've needed to change my Administrator password in Computer Management > Users.
For those people saying "use runas"
I could not use runas
because it prompts for a password and I can't pass it in the same command line.
PS: Remember to place cpau
in PHP folder.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.