LittleDuck 发表于 2008-10-6 16:52:03

如何远程运行QTP脚本(Running Scripts Remotely)

WSH 5.6 可以在远程系统上运行脚本。以下是例子。前提条件是文件“BeenHere.WSF”放在本地机器的“c:\wsh5.6”目录下。按需要修改远程机器名称。
当在本地机器上运行了RemoteTest.WSF以后,会出现“done”对话框。文件“"c:\beenhere.txt"”会创建,并写入时间。
' VBScript.
RemoteTest.WSF
-------------------------------
<package>
<job>
<script language="VBScript">
set oController = CreateObject("WSHController")
set oProcess = oController.CreateScript("c:\wsh5.6\beenhere.wsf", "remmachine")
oProcess.Execute
While oProcess.Status <> 2
   WScript.Sleep 100
WEnd
WScript.Echo "Done"
</script>
</job>
</package>
-------------------------------

BeenHere.WSF
-------------------------------
<package>
<job>
<script language="VBScript">
set fso = CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile("c:\beenhere.txt", true)
fout.WriteLine Now
fout.Close
</script>
</job>
</package>

我的疑问是,为什么远程机器不是本地机器,也就是另外一台可以找到的机器时,总是报错“permission denied”。如附件。

非常疑惑,希望碰到过类似问题的高手们解答一下。谢谢:)

[ 本帖最后由 LittleDuck 于 2008-10-7 16:55 编辑 ]

lantianwei 发表于 2008-10-7 09:49:22

我记得好像帮助中还有一段内容是告诉你如何开启远程目标机器跨机脚本运行的限制的

LittleDuck 发表于 2008-10-7 10:27:47

回复 2# 的帖子

lantianwei 好,谢谢回复:lol

你说的帮助是这一段不?Setting up Remote WSH 还是其他的,如果是其他的,麻烦说明一下。:)

To enable a machine to run remote scripts
1. Install WSH V5.6 on the machine. If you are using Windows 2001 or have installed Internet Explorer 6 or greater, WSH 5.6 has already been installed.
2. Add yourself to the remote machine's Local Administrators group.
3. To enable Remote WSH, use Poledit.exe on the server.
An administrator who wants to enable Remote WSH must either acquire the Windows 2000 resource kit, or use http://msdn.microsoft.com/scripting to acquire the necessary windowsscript.adm file that contains the WSH settings. The windowsscript.adm file must be copied to the server that sets the gapplicabel group's policies. Although it is not necessary to copy the file to the server's \WINNT\INF directory, this is nonetheless where the default adm files are located.
4. WSH should now be enabled on the machine. To test it, see Running Scripts Remotely.
不太清楚第三步是在干啥,谢谢指教

heqingbluesky 发表于 2008-10-7 10:55:12

Poledit.exe--这个是修改组策略的工具。但是要安装Server版本的服务器才有这个EXE文件,例如:Window 2000 server

LittleDuck 发表于 2008-10-7 16:52:27

经过研究,问题解决了。方案在以下链接。谢谢提供线索的战友们:lol

http://www.51testing.com/?156384/action_viewspace_itemid_94178.html
页: [1]
查看完整版本: 如何远程运行QTP脚本(Running Scripts Remotely)