CFEXECUTE assigning it to run with administrator rights

不想你离开。 提交于 2019-12-01 14:47:58

问题


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"

回答1:


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">


来源:https://stackoverflow.com/questions/42234407/cfexecute-assigning-it-to-run-with-administrator-rights

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!