<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dave Amenta .com &#187; Ping</title>
	<atom:link href="http://www.daveamenta.com/tag/ping/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daveamenta.com</link>
	<description>(dot (at dave daveamenta) com)</description>
	<lastBuildDate>Tue, 31 Jan 2012 17:22:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Ping remote host in Javascript using WMI</title>
		<link>http://www.daveamenta.com/2009-09/ping-remote-host-in-javascript-using-wmi/</link>
		<comments>http://www.daveamenta.com/2009-09/ping-remote-host-in-javascript-using-wmi/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 19:17:52 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Quick Tips]]></category>
		<category><![CDATA[Ping]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.daveamenta.com/?p=142</guid>
		<description><![CDATA[I&#8217;ve been working on a simple Windows Sidebar Gadget that will determine if a remote host is online or not. For the connectivity test I chose ping, since it&#8217;s lightweight and unlikely to disturb any services on a device. Ping using WMI function Ping&#40;host&#41; &#123; var wmi = GetObject&#40;&#34;Winmgmts:&#34;&#41;; var eStatus = new Enumerator&#40;wmi.ExecQuery&#40; &#34;Select [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a simple Windows Sidebar Gadget that will determine if a remote host is online or not.  For the connectivity test I chose ping, since it&#8217;s lightweight and unlikely to disturb any services on a device.</p>
<p><strong>Ping using WMI</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> Ping<span style="color: #009900;">&#40;</span>host<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> wmi <span style="color: #339933;">=</span> GetObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Winmgmts:&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> eStatus <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Enumerator<span style="color: #009900;">&#40;</span>wmi.<span style="color: #660066;">ExecQuery</span><span style="color: #009900;">&#40;</span>
<span style="color: #3366CC;">&quot;Select StatusCode from Win32_PingStatus Where Address='&quot;</span> <span style="color: #339933;">+</span> host <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> eStatus.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">StatusCode</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The function Ping will return true if the host is online, false otherwise.  Optionally, a Timeout parameter may be specified in the WMI query.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveamenta.com/2009-09/ping-remote-host-in-javascript-using-wmi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

