<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[gOxiA=苏繁=SuFan Blog]]></title> 
<link>https://maytide.net/index.php</link> 
<description><![CDATA[gOxiA,苏繁,sufan,Microsoft MVP]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[gOxiA=苏繁=SuFan Blog]]></copyright>
<item>
<link>https://maytide.net/read.php/865.htm</link>
<title><![CDATA[确定在所有进程中运行的服务]]></title> 
<author>gOxiA &lt;sufan_cn@msn.com&gt;</author>
<category><![CDATA[PowerShell 和脚本]]></category>
<pubDate>Sat, 09 Jul 2005 01:44:24 +0000</pubDate> 
<guid>https://maytide.net/read.php/865.htm</guid> 
<description>
<![CDATA[ 
	<span><div><p><strong>描述</strong><br />返回进程列表以及当前在每个进程中运行的所有服务。</p></div><div><p><br /><strong>脚本代码<br /></strong>set objIdDictionary = CreateObject(&quot;Scripting.Dictionary&quot;)<br />strComputer = &quot;.&quot;<br />Set objWMIService = GetObject(&quot;winmgmts:&quot; _<br />&amp; &quot;&#123; impersonationLevel=impersonate &#125;!&#92;&#92;&quot; &amp; strComputer &amp; &quot;&#92;root&#92;cimv2&quot;)<br />Set colServices = objWMIService.ExecQuery _<br />(&quot;Select * from Win32_Service Where State &lt;&gt; 'Stopped'&quot;)<br />For Each objService in colServices<br />If objIdDictionary.Exists(objService.ProcessID) Then<br />Else<br />objIdDictionary.Add objService.ProcessID, objService.ProcessID<br />End If<br />Next<br />colProcessIDs = objIdDictionary.Items<br />For i = 0 to objIdDictionary.Count - 1<br />Set colServices = objWMIService.ExecQuery _<br />(&quot;Select * from Win32_Service Where ProcessID = '&quot; &amp; _<br />colProcessIDs(i) &amp; &quot;'&quot;)<br />Wscript.Echo &quot;Process ID: &quot; &amp; colProcessIDs(i)<br />For Each objService in colServices<br />Wscript.Echo VbTab &amp; objService.DisplayName <br />Next<br />Next</p></div></span>
]]>
</description>
</item>
</channel>
</rss>