是否可以使用不同的域和用户运行Exec任务?
我需要在10个负载均衡器上重新启动iis,这可以用Nant-exe任务实现吗?
现在我有这样的脚本
<exec programm='iisreset'>
<arg line='${balancer}'/>
<arg line='/restart' />
</exec>
这是在集成环境中工作的(因为是同一个域),在测试中失败,Acces Denied。。
感谢
您可以在exec
调用中使用命令runas
,并使用/netonly
参数远程访问平衡器。
我想这可能看起来像这样:
<exec program="runas">
<arg line="/netonly" />
<arg line="${'/user:' + domain + '' + username}" />
<arg line="${'"iisreset ' + balancer + ' /restart"'}" />
</exec>
这可能对你有用,但我不确定你将如何自动给他密码。不过,您可以在cmd中使用/savecred
运行runas
一次。但要小心保存密码。。。
请注意,我无法对此进行测试,因为我没有进行测试所需的环境。
来源:http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/runas.mspx?mfr=true