Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CFEXECUTE assigning it to run with administrator rights

I am trying to change a password with active directory using cfexecute. The only code on my page is this (username and the new password are filled in):

<cfexecute
name="c:\windows\system32\cmd.exe"
arguments="NET USER username password /domain"
outputfile="C:\Users\administrator\Desktop\test.txt"
timeout="90">
</cfexecute>

When I tried running this code through dreamweaver on my pc the tab in my browser just kept spinning even after 5 min... I closed the tab went to the server logged in and the text.txt was there empty. But I am unable to delete it because it says coldfusion.exe is using it???? Also it did not change the users password.

So then I opened up the command line on my pc and ran NET USER username password /domain it gave me a System error 5 has occured. Access is denied..

So then I went on to the server logged in as an administrator ran NET USER username password /domain and it worked.

How do I tell cfexecute to run as that administrator when it runs so that it works properly?

I looked up the docs of cfexecute and it is not like cfldap where you can choose a username and password.

Any help with this would be greatly appreciated!

Edit

Also checked log files in admin and it stated this:

Error occurred: coldfusion.tagext.lang.ExecuteTag$TimeoutException: Timeout period expired without completion of c:\windows\system32\cmd.exe

(It cant run that simple command within a 90 second timeout? But runs instantly when I run it in the command line?) Is there something wrong with using cfexecute?

EDIT IS IT POSSIBLE? To Add a user it always runs as to change the password like so?:

"/c net user /user:domain\Administrator <admin-pwd> username password /domain"
like image 461
David Brierton Avatar asked Feb 14 '17 19:02

David Brierton


1 Answers

ColdFusion is only able to access the domain and user account that is used by the ColdFusion service.

If you want to authenticate a username/domain against local system or Windows domain using any version of ColdFusion, consider using the CFX_EXEC tag.

http://adiabata.com/cfx_exec.cfm

<CFX_EXEC
    CMD="NET USER username password /domain"
    USER="Administrator"
    PWD="pass"
    DOMAIN="domain"
    FILE="C:\Users\administrator\Desktop\test.txt">
like image 58
James Moberg Avatar answered Oct 07 '22 09:10

James Moberg