日期:2012-04-14  浏览次数:20457 次

--------------关闭指定程序----------
<job >
<script language="VBScript">


logip="127.0.0.1" //计算机标识
user="" //用户名
password="" //密码
APPname="qq.exe" //指定欲关闭的程序名
namespace="root\cimv2"


wScript.Echo "STRAT"

set wmiLocator = CreateObject ("WbemScripting.SWbemLocator")
set objwmi = wmiLocator.ConnectServer (logip, namespace, user, password)




set col =objwmi.execquery ("select * from Win32_Process where Name='"+APPname+"'")

for each colin in col
colin.terminate()

next
wScript.Echo "END"
</script>
</job>
----------------------------------------------运行指定程序----------------


<job >
<script language="VBScript">

logip="127.0.0.1" //计算机标识
user="" //用户名
password="" //密码

APPname="qq.exe" //指定欲启动的程序名

namespace="root\cimv2"


wScript.Echo "STRAT"






set wmiLocator = CreateObject ("WbemScripting.SWbemLocator")
set objwmi = wmiLocator.ConnectServer (logip, namespace, user, password)



'或
'set processClass = GetObject ("winmgmts:Win32_Process")
'retVal = processClass.Create (APPname)

set OBJ=objwmi.InstancesOf ("Win32_Proces")


OBJ.Create (APPname)





wScript.Echo "END"
</script>
</job>