Друзья, нужна помощь! Стоит задача: есть процесс ipmgui.exe, который запускается с некоторой периодичностью, скажем раз в 2-3 часа, и который, когда он запустится надо остановить. Я написал такой скрипт, который запускается при старте системы:
Код: Dim colProcessList, objProcess, ProcessName, ProcessIsRunning
ProcessName = "ipmgui.exe"
ProcessIsRunning = False
Do
Do while not ProcessIsRunning
Set colProcessList = Getobject("Winmgmts:").Execquery _
("Select * from Win32_Process Where Name ='" & ProcessName & "'")
If colProcessList.Count > 0 Then
ProcessIsRunning = True
End If
Set colProcessList = Nothing
Loop
Set colProcessList = GetObject("Winmgmts:").ExecQuery _
("Select * from Win32_Process Where Name ='" & ProcessName & "'")
For Each objProcess in colProcessList
objProcess.Terminate( )
Next
Set colProcessList = Nothing
Loop
Код: Dim colProcessList, objProcess, ProcessName, ProcessIsRunning
ProcessName = "ipmgui.exe"
ProcessIsRunning = False
Do
Do while not ProcessIsRunning
Set colProcessList = Getobject("Winmgmts:").Execquery _
("Select * from Win32_Process Where Name ='" & ProcessName & "'")
If colProcessList.Count > 0 Then
ProcessIsRunning = True
End If
Set colProcessList = Nothing
Loop
Set colProcessList = GetObject("Winmgmts:").ExecQuery _
("Select * from Win32_Process Where Name ='" & ProcessName & "'")
For Each objProcess in colProcessList
objProcess.Terminate( )
Next
Set colProcessList = Nothing
Loop