<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; VBS: Мониторинг процесса и действия над ним]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=7512</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=7512&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «VBS: Мониторинг процесса и действия над ним».]]></description>
		<lastBuildDate>Thu, 30 Aug 2012 12:34:53 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: VBS: Мониторинг процесса и действия над ним]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63336#p63336</link>
			<description><![CDATA[<div class="quotebox"><cite>smaharbA пишет:</cite><blockquote><p>and commandline like &#039;%-offline%&#039;</p></blockquote></div><p>Большое спасибо, все работает</p>]]></description>
			<author><![CDATA[null@example.com (bear62)]]></author>
			<pubDate>Thu, 30 Aug 2012 12:34:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63336#p63336</guid>
		</item>
		<item>
			<title><![CDATA[Re: VBS: Мониторинг процесса и действия над ним]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63331#p63331</link>
			<description><![CDATA[<p>and commandline like &#039;%-offline%&#039;</p>]]></description>
			<author><![CDATA[null@example.com (smaharbA)]]></author>
			<pubDate>Thu, 30 Aug 2012 11:43:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63331#p63331</guid>
		</item>
		<item>
			<title><![CDATA[VBS: Мониторинг процесса и действия над ним]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=63328#p63328</link>
			<description><![CDATA[<p>Здравствуйте. <br />Помогите, пожалуйста, с написанием скрипта. <br />Задача:<br />Необходимо проверять доступность удаленного сервера и если пинг есть:<br />1)&nbsp; проверить в процессах наличие процесса с &quot;командой запуска&quot; firefox.exe -offline, <br />2) если такой процесс есть, &quot;убиваем&quot; процесс firefox.exe<br />3) запускаем firefox.exe<br />если пинга нет:<br />1) проверить в процессах наличие процесса с &quot;командой запуска&quot; firefox.exe -offline<br />2) если такого процесса нет, &quot;убиваем&quot; процесс firefox.exe<br />3) запускаем firefox.exe -offline</p><p>Вопрос в следующем, как в запросе в качестве условия указать &quot;CommandLine&quot; , сейчас по имени процесса все работает;<br />CommandLine в WinXP выглядит следующим образом:<br />&quot;C:\Program Files\Mozilla Firefox\firefox.exe&quot; -offline </p><p>Вот, что получилось:<br /></p><div class="codebox"><pre><code>if ping (&quot;ya.ru&quot;) then

Set objService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)

If objService.ExecQuery(&quot;SELECT * FROM Win32_Process WHERE Name = &#039;firefox.exe&#039;&quot;).Count = 1 Then
            For Each objProc In objService.ExecQuery(&quot;SELECT * FROM Win32_Process WHERE Name = &#039;firefox.exe&#039;&quot;)
    objProc.Terminate
    Next
            Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
            WshShell.Run &quot;firefox.exe&quot;  
             Else

End if
else
Set objService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2&quot;)

If objService.ExecQuery(&quot;SELECT * FROM Win32_Process WHERE Name = &#039;firefox.exe&#039;&quot;).Count = 1 Then
                 Else
    For Each objProc In objService.ExecQuery(&quot;SELECT * FROM Win32_Process WHERE Name = &#039;firefox.exe&#039;&quot;)
    objProc.Terminate             
     Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
    WshShell.Run &quot;firefox.exe -offline&quot;  
    End If

Function Ping(strAddr)
&#039; Проверяем доступность компьютера с помощью команды PING 
        Set objShell = CreateObject(&quot;WScript.Shell&quot;)
        Set objScriptExec = objShell.Exec(&quot;%comspec% /c ping.exe -n 1 &quot; &amp; strAddr)
        strPingResults = LCase(objScriptExec.StdOut.ReadAll)
        Ping = InStr(strPingResults, &quot;ttl=&quot;)
        
End Function
End if</code></pre></div><p>Буду благодарен за любую помощь</p>]]></description>
			<author><![CDATA[null@example.com (bear62)]]></author>
			<pubDate>Thu, 30 Aug 2012 10:52:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=63328#p63328</guid>
		</item>
	</channel>
</rss>
