|
text = inputbox("Enter the process you want to close")
strComputer = "."
PROCESS_NAME = text
Set objNetwork = Wscript.CreateObjec("Wscript.Network")
currUser = objNetwork.UserName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("SELECT * FROM Win32_Process WHERE Name = '" & PROCESS_NAME & "'")
counter = 0
For Each objProcess In colProcessList
if objProcess.GetOwner ( User, Domain ) = 0 Then
if LCase(User) = currUser Then
counter = counter + 1
End if
End if
Next
MsgBox counter & " Processes of , " & PROCESS_NAME & " , Have been Found"
这段脚本是获取指定进程的,并统计出存在的个数。
我要问的问题是,在QTP中执行这段脚本时,执行到第四行时,老是报找不到“wscript”对象,请问该怎么解决?谢谢! |
|