Friday, January 29, 2010

Kill QTP Using Your Mobile Phone

If you want to kill QTP when you are not in your work place, then try the below technique. But you need MS Outlook in your remote PC and mobile phone with GPRS.

Step 1:

Create a VBS file with the below code and save it wherever you want it in your PC,

Option Explicit

Dim objWMIService, objProcess, colProcess

Dim strComputer, strProcessKill

strComputer = "."

strProcessKill = "'QTPro.exe'"

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" _

& strComputer & "\root\cimv2")

Set colProcess = objWMIService.ExecQuery _

("Select * from Win32_Process Where Name = " & strProcessKill )

For Each objProcess in colProcess

objProcess.Terminate()

Next

WScript.Quit


Step 2:

Open notepad, paste the below code and save it as bat file (I.e. .bat format)

C:\WINDOWS\system32\cscript.exe "C:\Documents and Settings\Administrator\Desktop\testbat.vbs"

Make sure to mention your VBS file’s location in your bat file.


Step 3:

Open Outlook and select Tools->Rules and Alerts…



Click on New Rule

Select ‘Check messages when they arrive’ option and click on ‘Next’ button.

Select the checkbox as same as below and click on ‘specific words’ link.

*Type any text in the below indicated textbox, click Add button and press OK. Here I have typed ‘Start Script’ and this is also my email's subject. This is case sensitive. While sending email ‘Start Script’ text should be your email’s subject.

Select start application checkbox as same as below and click on application link. Then you have to browse the bat file which you have just created in the Step 2: and click on Finish button.

And finally you will see the new rule in Rules and Alerts window as same as below and click on ‘Apply’ button.

Now you are ready to kill your QTP from remote place. Just send an email to your email address through your mobile phone. Note: Your MS Outlook application should be in active mode in your remote PC.

*The email’s subject should match with your rule specified word.

After sending the e-mail, QTP exe will be killed from your remote PC.


Please let me know if you face any issues.