我正在尝试使用cfexecute
更改使用活动目录的密码。
我页面上唯一的代码是这个(填写用户名和新密码):
<cfexecute
name="c:\windows\system32\cmd.exe"
arguments="NET USER username password /domain"
outputfile="C:\Users\administrator\Desktop\test.txt"
timeout="90">
</cfexecute>
当我尝试通过我的电脑上的Dreamweaver运行此代码时,我的浏览器中的选项卡在5分钟后仍然保持旋转...我关闭了选项卡,登录到服务器并且text.txt是空的。但是我无法删除它,因为它说coldfusion.exe正在使用它?它也没有改变用户密码。
然后我在我的电脑上打开命令行并运行NET USER username password /domain
它给了我一个System error 5 has occured. Access is denied.
。
然后,当管理员运行NET USER username password /domain
时,我继续登录到服务器,并且它运行良好。
如何告诉cfexecute在运行时以该管理员身份运行,以使其正常运行?
我查了cfexecute的文档,它不像cfldap,你可以选择用户名和密码。
非常感谢任何帮助!
修改
还检查了admin中的日志文件,并说明了这一点:
Error occurred: coldfusion.tagext.lang.ExecuteTag$TimeoutException: Timeout period expired without completion of c:\windows\system32\cmd.exe
(它在90秒的超时内无法运行那个简单的命令?但是当我在命令行中运行它时会立即运行?)使用cfexecute是否有问题?
编辑是否可能? 要添加用户,它总是运行以更改密码,如此?:
"/c net user /user:domain\Administrator <admin-pwd> username password /domain"
答案 0 :(得分:6)
ColdFusion只能访问ColdFusion服务使用的域和用户帐户。
如果要使用任何版本的ColdFusion对本地系统或Windows域验证用户名/域,请考虑使用CFX_EXEC标记。
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">