<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>David Szabo's [MSFT] blog : MOM</title><link>http://blogs.msdn.com/dszabo/archive/tags/MOM/default.aspx</link><description>Tags: MOM</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>MOM 2005 Response Script Tracing</title><link>http://blogs.msdn.com/dszabo/archive/2007/03/01/mom-2005-response-script-tracing.aspx</link><pubDate>Thu, 01 Mar 2007 13:22:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1778231</guid><dc:creator>dszabo</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dszabo/comments/1778231.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dszabo/commentrss.aspx?PostID=1778231</wfw:commentRss><description>&lt;p&gt;I've been writing a MOM response script that stopped working at some point, so I had to debug or trace it. Of course, at the time I was able to check it, the problem already got solved. So, I decided to turn on tracing and give some time for the problem to re-occur.&lt;/p&gt; &lt;p&gt;The script was developed to write trace messages at different points using the &lt;font face="Courier New"&gt;ScriptContext.Echo(string)&lt;/font&gt; method, but I never tried this feature. I did a search on MSDN and found that I have to enable debugging on the *MOM AGENT* (my script runs on a remote agent box, so I have to do it there) in order to get these messages logged somewhere. The following article shows the registry keys: &lt;a title="http://msdn2.microsoft.com/en-us/library/ms824564.aspx" href="http://msdn2.microsoft.com/en-us/library/ms824564.aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms824564.aspx&lt;/a&gt;. Briefly, they are:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Mission Critical Software\OnePoint\&lt;strong&gt;EnableActiveDebugging&lt;/strong&gt;&lt;/font&gt;&lt;strong&gt; &lt;/strong&gt;= 1&lt;/li&gt; &lt;li&gt;&lt;font face="Courier New"&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Mission Critical Software\OnePoint\&lt;strong&gt;DebugEnabledScripts&lt;/strong&gt;&lt;/font&gt; = &amp;lt;Your Response Script name&amp;gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Did that, restarted the MOM service on the agent box and found that a new log file created under &lt;em&gt;C:\WINDOWS\Temp\Microsoft Operations Manager &lt;/em&gt;with a name of "&lt;em&gt;AgentResponses-&amp;lt;Mgmt group name&amp;gt;&amp;nbsp;MOM.log&lt;/em&gt;", containing the last trace result of my response script.&lt;/p&gt; &lt;p&gt;So far so good, but I want to let my script-friend here doing his job and I want MOM to log every run, so I could analyze it next week when I come back. Unfortunately, MOM doesn't provide this nice feature to you, so I had to write my own scheduled task that does it:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;1. Created a batch script, called MomLogGatherer, with the following content (the current trace file is assigned to an existing file):&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Courier New"&gt;type "C:\WINDOWS\Temp\Microsoft Operations Manager\AgentResponses-&amp;lt;Mgmt group name&amp;gt;&amp;nbsp;MOM.log" &amp;gt;&amp;gt; C:\dszabo_MS\MomLog\momlog.txt&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;2. Created a scheduled task to call the batch script in every 5 minutes (the response script in MOM is scheduled to run in every 5 mins)&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;I just have to take care to archive the file sometimes before it gets too big.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1778231" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dszabo/archive/tags/debugging/default.aspx">debugging</category><category domain="http://blogs.msdn.com/dszabo/archive/tags/MOM/default.aspx">MOM</category></item></channel></rss>