<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; JS: как проанализировать остановку службы с помощью кода возврата]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=10929&amp;type=atom" />
	<updated>2015-09-07T08:03:43Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=10929</id>
		<entry>
			<title type="html"><![CDATA[Re: JS: как проанализировать остановку службы с помощью кода возврата]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97180#p97180" />
			<content type="html"><![CDATA[<p>разобрался, свё вроде корректно работает, если </p><div class="codebox"><pre><code>ret ==0xffff</code></pre></div>]]></content>
			<author>
				<name><![CDATA[im2002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28063</uri>
			</author>
			<updated>2015-09-07T08:03:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97180#p97180</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[JS: как проанализировать остановку службы с помощью кода возврата]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=97177#p97177" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>var objShell = WScript.CreateObject(&quot;Shell.Application&quot;);             
var ServiceName = &quot;MSSQL$SQL2000&quot;;


if(objShell.IsServiceRunning(ServiceName) == true)            
    {
    WScript.Echo(&quot;1. Служба: &quot; + ServiceName + &quot; работает&quot;);
    }
    
else    {
    WScript.Echo(&quot;2. Служба: &quot; + ServiceName + &quot; остановлена&quot;);
    }
                                    
var ret = objShell.ServiceStop(ServiceName, false);
WScript.Sleep(5000);
    
if(ret==0)
    {
    WScript.Echo(&quot;3. Служба: &quot; + ServiceName + &quot; остановлена&quot;);
    }
else    {
    WScript.Echo(&quot;4. Служба: &quot; + ServiceName + &quot; работает!!!&quot;);
    }</code></pre></div><p>Сообщение 4 показывает всегда, что служба работает.<br />Хочу добиться результата, что при работающей изначально службе будут выходить сообщ. 1, что служба работает.<br />а затем сообщ. 3, что служба остановлена.</p>]]></content>
			<author>
				<name><![CDATA[im2002]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28063</uri>
			</author>
			<updated>2015-09-07T07:13:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=97177#p97177</id>
		</entry>
</feed>
