<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Удаление процессов с условием]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14646&amp;type=atom" />
	<updated>2019-03-15T15:50:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14646</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132913#p132913" />
			<content type="html"><![CDATA[<p>Думаю вот так можно. Строку с уничтожением процессов я закомментировал. Кстати в список надо внести WScript.exe / CScript.exe, иначе процесс &quot;грохнет&quot; сам себя.</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2019-03-15T15:50:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132913#p132913</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132912#p132912" />
			<content type="html"><![CDATA[<p><strong>Xameleon</strong></p><p>А если вот так упростить?</p><div class="codebox"><pre><code>List = &quot;C:\IgnoreListProcesses_ANSI.txt&quot;
List = vbLf &amp; CreateObject(&quot;Scripting.FileSystemObject&quot;).OpenTextFile(List).ReadAll &amp; vbCr
For Each Pr In GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2&quot;).ExecQuery(&quot;Select Name from Win32_Process&quot;)
  If InStr(List, vbLf &amp; Pr.Name &amp; vbCr) = 0 Then Pr.Terminate
Next</code></pre></div><p>только оно выдает ошибку <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[xrom8]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40011</uri>
			</author>
			<updated>2019-03-15T14:36:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132912#p132912</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132911#p132911" />
			<content type="html"><![CDATA[<p>Отлично ! Это уже большой шаг. У Вас в коде указан запрос<br /></p><div class="quotebox"><blockquote><p>&quot;Select * from win32_process where name = &#039;&quot; _<br />		&amp;processname&amp;&quot;&#039;&quot;</p></blockquote></div><p>Т.е отбор по условию. Если от условия избавиться, то будут возвращаться все процессы. </p><div class="codebox"><pre><code>&quot;Select * from win32_process&quot; </code></pre></div><p>А дальше уже можете выбрать, что с ними делать.</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2019-03-15T14:14:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132911#p132911</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132910#p132910" />
			<content type="html"><![CDATA[<p><strong>Xameleon</strong><br />Копаюсь в синтаксе, получилось пока только остановить процессы которые в файле, но мне нужен обратный результат...<br /></p><div class="codebox"><pre><code>strcomputer=&quot;.&quot;
set FSO=CreateObject(&quot;Scripting.filesystemobject&quot;)
set readfile=FSO.openTextFile(&quot;C:\users\Scriptman\kill.txt&quot;)
set wmi=GetObject(&quot;winmgmts:{impersonationlevel=impersonate}!\\&quot; _
&amp;strcomputer&amp;&quot;\root\cimv2&quot;)
do until readfile.atEndOfStream
	processname=readfile.readline
		set colprocesses=wmi.execquery(&quot;Select * from win32_process where name = &#039;&quot; _
		&amp;processname&amp;&quot;&#039;&quot;)
			if colprocesses.count&gt;0 then
					for each obj in colprocesses
						If obj.GetOwner (Username) = 0 Then
							if username=&quot;Scriptman&quot; then
							&#039;wscript.echo &quot;killing &quot;&amp;obj.name
							obj.terminate()
							end if
						end if
					next
			end if
		
loop</code></pre></div>]]></content>
			<author>
				<name><![CDATA[xrom8]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40011</uri>
			</author>
			<updated>2019-03-15T13:48:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132910#p132910</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132909#p132909" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>xrom8 пишет:</cite><blockquote><p>Прошу не кидать в меня тряпки, я в этом новичок.</p></blockquote></div><p>А тряпок нет, есть только кирпичи и гири. <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p><p>Возник встречный вопрос - какие шаги были Вами сделаны на пути к решению задачи ?</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2019-03-15T13:28:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132909#p132909</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS: Удаление процессов с условием]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=132908#p132908" />
			<content type="html"><![CDATA[<p>Необходимо: <br />Создать скрипт который: <br />&quot;Убивает&quot; все процессы, которые висят в памяти <strong>и не упомянуты в файле со списком имен процессов</strong>.<br />Прошу не кидать в меня тряпки, я в этом новичок.</p>]]></content>
			<author>
				<name><![CDATA[xrom8]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40011</uri>
			</author>
			<updated>2019-03-15T12:17:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=132908#p132908</id>
		</entry>
</feed>
