01-27-2013, 05:22 AM
Hi I need help to connect remote machine and execute vbscript(test scripts) by opening QTP application.
By using VB Script I have connect one workstaiton to another workstation and I have to open QTP application by uisng QTP application I have to run test script.
Can you please help me .. Because I have no much knowledge about this script..
By using VB Script I have connect one workstaiton to another workstation and I have to open QTP application by uisng QTP application I have to run test script.
Can you please help me .. Because I have no much knowledge about this script..
Code:
strUser = "K003277"
strDomain = "PNKUKDEV"
strComputer ="DV01123"
strPassword = "Pork2013"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, _
"root\CIMV2", _
strUser, _
strPassword, _
"MS_409", _
"NTLMDomain:" + strDomain)
Dim QTApp = objWMIService.Create("QTPro.exe", null, null, intQTPID)
'set TApp = GetObject(QTApp)
QtApp.Open "C:\Temp\simple_test.vbs", True '
Set qtTest = qtApp.Test
qtTest.Run
Set colProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent " _
& "Within 1 Where TargetInstance ISA 'Win32_Process'")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where ProcessID = " & intQTPID)
For Each objProcess in colProcesses
objProcess.Terminate()
Next