<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>JIMMY HARPER'S OPERATIONS MANAGER BLOG : Service</title><link>http://blogs.technet.com/jimmyharper/archive/tags/Service/default.aspx</link><description>Tags: Service</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Service Monitors – What does the “State” value mean?</title><link>http://blogs.technet.com/jimmyharper/archive/2009/08/12/service-monitors-what-does-the-state-value-mean.aspx</link><pubDate>Wed, 12 Aug 2009 02:00:19 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3272546</guid><dc:creator>jimmyharper</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/jimmyharper/comments/3272546.aspx</comments><wfw:commentRss>http://blogs.technet.com/jimmyharper/commentrss.aspx?PostID=3272546</wfw:commentRss><description>&lt;p&gt;When you create a Service Monitor in OpsMgr 2007, we get an alert / state change when the service is not running, but this does not necessarily mean that the service is “stopped”.&amp;#160; The monitor attempts to get the “State” of the service, and alerts when the State is not “Running”.&amp;#160; So, what other states are there?&amp;#160; Here is a list of possible service states, copied from &lt;a title="http://msdn.microsoft.com/en-us/library/ms685996(VS.85).aspx" href="http://msdn.microsoft.com/en-us/library/ms685996(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms685996(VS.85).aspx&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/ServiceMonitorsWhatdoestheStatevaluemean_FCB5/image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/ServiceMonitorsWhatdoestheStatevaluemean_FCB5/image_thumb_1.png" width="1288" height="396" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;However, I recently ran into an issue where we got an alert from a Service Monitor and Health Explorer showed that State=9:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/ServiceMonitorsWhatdoestheStatevaluemean_FCB5/image_6.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/ServiceMonitorsWhatdoestheStatevaluemean_FCB5/image_thumb_2.png" width="546" height="302" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;After checking with the OpsMgr product group, I found that State=9 means “Server not found”, and we get this when we fail to open SCManaged with “RPC_S_SERVER_UNAVAILABLE”.&amp;#160; In this particular case, the problem was on a clustered server which had failed over to the second node, which did not have the OpsMgr Agent installed.&lt;/p&gt;  &lt;p&gt;We also have two other states that are not listed in the above table.&amp;#160; State=8 means “Service not found” (we’re trying to monitor a service that does not exist on the agent), and State=0 means “Unknown state”….not sure exactly when we would see this.&lt;/p&gt;  &lt;p&gt;So, here’s the final list of State values that you may see on a service monitor:&lt;/p&gt;  &lt;p&gt;0 = MOM_SERVICE_UNKNOWN_STATE   &lt;br /&gt;1 = MOM_SERVICE_STOPPED    &lt;br /&gt;2 = MOM_SERVICE_START_PENDING    &lt;br /&gt;3 = MOM_SERVICE_STOP_PENDING    &lt;br /&gt;4 = MOM_SERVICE_RUNNING    &lt;br /&gt;5 = MOM_SERVICE_CONTINUE_PENDING    &lt;br /&gt;6 = MOM_SERVICE_PAUSE_PENDING    &lt;br /&gt;7 = MOM_SERVICE_PAUSED    &lt;br /&gt;8 = MOM_SERVICE_NOT_FOUND    &lt;br /&gt;9 = MOM_SERVER_NOT_FOUND&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3272546" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Monitor/default.aspx">Monitor</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Service/default.aspx">Service</category></item><item><title>SQL Server Full Text Search Service Monitor</title><link>http://blogs.technet.com/jimmyharper/archive/2009/07/02/sql-server-full-text-search-service-monitor.aspx</link><pubDate>Thu, 02 Jul 2009 10:41:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3260651</guid><dc:creator>jimmyharper</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.technet.com/jimmyharper/comments/3260651.aspx</comments><wfw:commentRss>http://blogs.technet.com/jimmyharper/commentrss.aspx?PostID=3260651</wfw:commentRss><description>&lt;P&gt;This issue is described in the SQL Server Management Pack Guide, but I wanted to blog it since I’ve seen a couple customers hit it.&lt;/P&gt;
&lt;P&gt;In the current version of the SQL Server Management Pack (version 6.0.6559.0), we have a monitor for the SQL Server Full Text Search Service which is targeted at the SQL 2005/2008 DB Engine classes.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_2.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_2.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb.png" width=833 height=496 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is, this is an optional component in SQL Server and is not always installed.&amp;nbsp; So, for servers where this service is not installed, we will see a lot of the following alerts:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Alert Name:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Service Check Probe Module Failed Execution&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Service Check Data Source Module Failed Execution&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Alert Description:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Error getting state of service Error: 0x8007007b Details: The filename, directory name, or volume label syntax is incorrect. One or more workflows were affected by this. Workflow name: Microsoft.SQLServer.2005.DBEngine.FullTextSearchServiceMonitor Instance name: MSSQLSERVER Instance ID: {625091EA-A1D9-1857-802C-0D908C93A5BB} Management group: jimmyh_mg1 &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_10.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_10.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_4.png" width=836 height=348 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To fix this, all we need to do is disable this monitor on any SQL Server that does not have the Full Text Search Service installed.&amp;nbsp; The easiest way to do this is to create a group for all of the SQL Instances that do not have the service installed.&amp;nbsp; The Full Text Search Service name is one of the discovered properties for the DB Engine class and will be blank if the service is not installed:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_4.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_4.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_1.png" width=708 height=321 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a group of SQL instances that do not have it installed, we can just use the criteria “Does not match regular expression . (dot)”, like this:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_6.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_6.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_2.png" width=588 height=701 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_2.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, just set an “Enabled=False” override on the monitor, targeted at this group:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_8.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_8.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_3.png" width=702 height=500 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Repeat the same steps to create the group and override for SQL 2008 DB Engines.&lt;/P&gt;
&lt;P&gt;One more thing that you’ll want to do with this monitor is set the “Alert only if startup type is automatic” override to False for clustered SQL Instances…..since the service will always be in a Manual startup mode.&lt;/P&gt;
&lt;P&gt;To do this, I create a group of Cluster SQL Instances where Full Text Search Service IS Installed:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_12.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_12.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_5.png" width=580 height=699 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_5.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And target the override at this group:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_14.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_14.png"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title=image border=0 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_6.png" width=699 height=503 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/f32844acbbb8_1F9C/image_thumb_6.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, repeat for SQL 2008 DB Engines.&lt;/P&gt;
&lt;P&gt;Attached is a sample MP that contains the above groups and overrides for SQL 2005 DB Engines.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UPDATED:&lt;/P&gt;
&lt;P&gt;I've removed the original attachment and attached a .zip file that contains these MPs for both SQL 2005 and SQL 2008.&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3260651" width="1" height="1"&gt;</description><enclosure url="http://blogs.technet.com/jimmyharper/attachment/3260651.ashx" length="3857" type="application/x-zip-compressed" /><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Monitor/default.aspx">Monitor</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Service/default.aspx">Service</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Service+Monitor+SQL+Cluster/default.aspx">Service Monitor SQL Cluster</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/SQL/default.aspx">SQL</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Management+Pack/default.aspx">Management Pack</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Full+Text+Search/default.aspx">Full Text Search</category></item><item><title>Monitoring a service for State and StartMode</title><link>http://blogs.technet.com/jimmyharper/archive/2008/08/10/monitoring-a-service-for-state-and-startmode.aspx</link><pubDate>Sun, 10 Aug 2008 04:45:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3103036</guid><dc:creator>jimmyharper</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.technet.com/jimmyharper/comments/3103036.aspx</comments><wfw:commentRss>http://blogs.technet.com/jimmyharper/commentrss.aspx?PostID=3103036</wfw:commentRss><description>&lt;P&gt;I recently had a customer that wants to get an alert when a specific service is not Disabled and/or not Stopped.&amp;nbsp; I used the following steps to accomplish this using a "Timed Script Three State Monitor".&amp;nbsp; Even if you do not have this specific need, these steps can be used as a template for creating a monitor that uses a script to query WMI and change state or generate alerts based on the results.&amp;nbsp; If you don't have a need for three states (Critical, Warning, Healthy), there is a Two State Monitor that can be used for this.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a new Monitor, select Scripting\Generic\Timed Script Three State Monitor&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_3.png" width=497 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_3.png"&gt;&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=scid:0767317B-992E-4b12-91E0-4F059A8CECA8:0cd5adb7-3e5b-4abe-a35b-5a927d5997d5 style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;Technorati Tags: &lt;A href="http://technorati.com/tags/Operations%20Manager" rel=tag mce_href="http://technorati.com/tags/Operations%20Manager"&gt;Operations Manager&lt;/A&gt;,&lt;A href="http://technorati.com/tags/monitor" rel=tag mce_href="http://technorati.com/tags/monitor"&gt;monitor&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Three-state" rel=tag mce_href="http://technorati.com/tags/Three-state"&gt;Three-state&lt;/A&gt;,&lt;A href="http://technorati.com/tags/Two-state" rel=tag mce_href="http://technorati.com/tags/Two-state"&gt;Two-state&lt;/A&gt;,&lt;A href="http://technorati.com/tags/service" rel=tag mce_href="http://technorati.com/tags/service"&gt;service&lt;/A&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give it a name, target, etc. (I targeted the Windows Computer class, but Windows Operating System may be a better choice).&amp;nbsp; I try to make a habit of unchecking "Monitor is enabled" and enabling it with an override later....at least while testing it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_25.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_25.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_10.png" width=514 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_10.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Set the schedule...this just depends on how quickly you want to know if the service gets changed:&lt;/P&gt;
&lt;P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_9.png" width=497 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_9.png"&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, I used a basic VB script which accepts a service name as a parameter, queries WMI for the service, and puts the Service Name, State (Running, Stopped, etc.), and StartMode (Disabled, Manual, Automatic) into property bag values.&amp;nbsp; The full text of the script is below the screenshot:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_11.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_11.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_3.png" width=496 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;---------------------------------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Dim oAPI, oBag,strComputer&lt;BR&gt;Set oAPI = CreateObject("MOM.ScriptAPI")&lt;BR&gt;Set oBag = oAPI.CreatePropertyBag()&lt;BR&gt;set oArgs=wscript.arguments&lt;BR&gt;strComputer="."&lt;BR&gt;ServName=oArgs(0) 
&lt;P&gt;Set namespace=GetObject("winmgmts:\\"&amp;amp; strComputer &amp;amp; "\root\cimv2")&lt;BR&gt;set servinfo=namespace.ExecQuery("select * from win32_service where name =" &amp;amp; """" &amp;amp; servname &amp;amp; """") 
&lt;P&gt;for each objservice in servinfo 
&lt;P&gt;Call oBag.AddValue("ServiceName",ServName)&lt;BR&gt;Call oBag.AddValue("State",objservice.State)&lt;BR&gt;Call oBag.AddValue("StartMode",objservice.StartMode)&lt;BR&gt;Call oAPI.Return(oBag) 
&lt;P&gt;next 
&lt;P&gt;--------------------------------------------------------------------------------------------------- 
&lt;P&gt;For the script parameter, I just enter "ServiceName"....this will be replaced by an override later, or you can just enter your service name here: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_23.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_23.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_9.png" width=519 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_9.png"&gt;&lt;/A&gt; 
&lt;P&gt;Next, I set the "Unhealthy", "Degraded", and "Healthy" expressions for the monitor.&amp;nbsp; My goal is to set the state to Warning when the service is Stopped but NOT Disabled , Critical when it is NOT Stopped, and Healthy when it is Stopped AND Disabled.&amp;nbsp; I used the following expressions: 
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Unhealthy Expression:&lt;/U&gt;&lt;/STRONG&gt; 
&lt;P&gt;&lt;STRONG&gt;Parameter Name:&lt;/STRONG&gt; Property[@Name='State'] 
&lt;P&gt;&lt;STRONG&gt;Operator:&lt;/STRONG&gt; Does not equal 
&lt;P&gt;&lt;STRONG&gt;Value:&lt;/STRONG&gt; Stopped 
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Degraded Expression:&lt;/U&gt;&lt;/STRONG&gt; 
&lt;P&gt;&lt;STRONG&gt;Parameter Name:&lt;/STRONG&gt; Property[@Name='StartMode'] 
&lt;P&gt;&lt;STRONG&gt;Operator:&lt;/STRONG&gt; Does not equal 
&lt;P&gt;&lt;STRONG&gt;Value:&lt;/STRONG&gt; Disabled&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Parameter Name:&lt;/STRONG&gt; Property[@Name='State'] 
&lt;P&gt;&lt;STRONG&gt;Operator:&lt;/STRONG&gt; Equals 
&lt;P&gt;&lt;STRONG&gt;Value:&lt;/STRONG&gt; Stopped&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Healthy Expression:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Parameter Name:&lt;/STRONG&gt; Property[@Name='StartMode'] 
&lt;P&gt;&lt;STRONG&gt;Operator:&lt;/STRONG&gt; Equals 
&lt;P&gt;&lt;STRONG&gt;Value:&lt;/STRONG&gt; Disabled&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;AND&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Parameter Name:&lt;/STRONG&gt; Property[@Name='State'] 
&lt;P&gt;&lt;STRONG&gt;Operator:&lt;/STRONG&gt; Equals 
&lt;P&gt;&lt;STRONG&gt;Value:&lt;/STRONG&gt; Stopped&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_13.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_13.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_4.png" width=522 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_4.png"&gt;&lt;/A&gt; 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_49.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_49.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_22.png" width=514 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_22.png"&gt;&lt;/A&gt; 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_17.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_17.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_6.png" width=516 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_6.png"&gt;&lt;/A&gt; 
&lt;P&gt;Next, I used the default settings for Health State, since they already match what I want to do: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_19.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_19.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_7.png" width=521 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_7.png"&gt;&lt;/A&gt; 
&lt;P&gt;Next, I configure the alert settings.&amp;nbsp; The settings in the screen shot below will generate a Warning alert when the monitor is in a Warning state (service is not Disabled), and a Critical alert when the monitor is in the Critical state (service is not Stopped).&amp;nbsp; The Alert Description will have the service name (using the ServiceName property created by the script): 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_21.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_21.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_8.png" width=516 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_8.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P&gt;Now that I have the monitor created, I need to enable it and set the Override for the Service Name: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_27.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_27.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=321 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_11.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_11.png"&gt;&lt;/A&gt; 
&lt;P&gt;I'm using the Alerter service for my test: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_29.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_29.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=484 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_12.png" width=472 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_12.png"&gt;&lt;/A&gt; 
&lt;P&gt;To test the monitor, I first set the Alerter service to Manual Startup and leave it stopped: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_31.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_31.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=143 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_13.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_13.png"&gt;&lt;/A&gt; 
&lt;P&gt;Then I verify that I get the Warning alert: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_39.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_39.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=397 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_17.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_17.png"&gt;&lt;/A&gt; 
&lt;P&gt;Health Explorer correctly shows the "Degraded" Warning state: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_41.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_41.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=327 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_18.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_18.png"&gt;&lt;/A&gt; 
&lt;P&gt;Now I want to test the Critical state, so I start the Alerter Service: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_37.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_37.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=188 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_16.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_16.png"&gt;&lt;/A&gt; 
&lt;P&gt;Now the alert is changed to Critical: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_43.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_43.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=393 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_19.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_19.png"&gt;&lt;/A&gt; 
&lt;P&gt;And Health Explorer shows the "Unhealthy" Critical state: 
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_45.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_45.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=313 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_20.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_20.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I stop the service and disable it, the alert is auto-resolved and the state is changed back to Healthy:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_47.png" mce_href="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_47.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=310 alt=image src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_21.png" width=644 border=0 mce_src="http://blogs.technet.com/blogfiles/jimmyharper/WindowsLiveWriter/5a596b1689ae_10E0B/image_thumb_21.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've attached my sample MP which includes the following monitors:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;U&gt;Service disabled and stopped - two-state monitor:&lt;/U&gt;&lt;/B&gt; 
&lt;P&gt;If the specified service is not Stopped AND Disabled, the computer will be put in a Warning state and a Warning alert will be generated.&amp;nbsp; When the service is stopped and disabled, the computer will be put in a Healthy state. 
&lt;P&gt;&lt;B&gt;&lt;U&gt;Service disabled and stopped - three-state monitor:&lt;/U&gt;&lt;/B&gt; 
&lt;P&gt;If the specified service is Stopped and is not Disabled, the computer will be put in a Warning state and a Warning alert will be generated.&amp;nbsp; If the specified service is not Stopped, the computer will be put in a critical state and a Critical alert will be generated.&amp;nbsp; When the service is stopped and disabled, the computer will be put in a Healthy state. 
&lt;P&gt;&lt;B&gt;&lt;U&gt;Usage:&lt;/U&gt;&lt;/B&gt; 
&lt;P&gt;Both monitors are targeted at the Windows Computer class and roll up to the Configuration Health.&amp;nbsp; Both monitors are disabled by default.&amp;nbsp; They are configured to check the service every 1 minute.&amp;nbsp; To enable one of the monitors, add an Override for the Computer or Group you wish to monitor and set the following Override parameters: 
&lt;P&gt;&lt;B&gt;Enabled=True&lt;/B&gt; 
&lt;P&gt;&lt;B&gt;Script Arguments = &amp;lt;Service Name&amp;gt;&lt;/B&gt; 
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Enjoy!!&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3103036" width="1" height="1"&gt;</description><enclosure url="http://blogs.technet.com/jimmyharper/attachment/3103036.ashx" length="15689" type="text/xml" /><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Monitor/default.aspx">Monitor</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Service/default.aspx">Service</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Three-state/default.aspx">Three-state</category><category domain="http://blogs.technet.com/jimmyharper/archive/tags/Two-state/default.aspx">Two-state</category></item></channel></rss>