<?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>Automating the Infrastructure : WMI</title><link>http://blogs.technet.com/ati/archive/tags/WMI/default.aspx</link><description>Tags: WMI</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WMI Events in OpsMgr 2007</title><link>http://blogs.technet.com/ati/archive/2007/04/07/wmi-events-in-opsmgr-2007.aspx</link><pubDate>Sat, 07 Apr 2007 23:12:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:733962</guid><dc:creator>Brian Wren</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/ati/comments/733962.aspx</comments><wfw:commentRss>http://blogs.technet.com/ati/commentrss.aspx?PostID=733962</wfw:commentRss><description>&lt;p&gt;I've already explained how to work with WMI events in MOM 2005 in&amp;nbsp;an article in &lt;a class="" href="http://www.microsoft.com/technet/technetmag/issues/2006/09/WMIEvents" mce_href="http://www.microsoft.com/technet/technetmag/issues/2006/09/WMIEvents"&gt;TechNet Magazine&lt;/a&gt;.&amp;nbsp; Most of the information in that article still applies since it covers the basics of how WMI events work and how to write a query to detect them.&amp;nbsp; What has changed significantly though is how to use them in Operations Manager.&amp;nbsp; I suppose a follow up article would be in order, but a simple blog post should be enough to give you the information you need.&lt;/p&gt; &lt;p&gt;First of all, WMI events in OpsMgr 2007 are used for exactly the same purpose as in MOM 2005.&amp;nbsp; The one big difference is that we no longer have WMI providers for OpsMgr objects to monitor for things like the modification of an alert.&amp;nbsp; We're working on such a different platform though, that those old scenarios don't really apply anymore anyway.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I'm going to speak completely in terms of the Operations Console since that's where most people work with Operations Manager - at least at this early stage of its life.&amp;nbsp; If you're more comfortable working directory with the XML of a management pack, then you'll know exactly what pieces of this information to pull out.&lt;/p&gt; &lt;p&gt;You can create a monitor or rule for a WMI event using the appropriate wizard in the Operations Console.&amp;nbsp; If I have to guide you to those or define the different between an rule and a monitor, then you probably want to start on some more basic monitoring before tackling this topic.&amp;nbsp; The namespace and query are going to be exactly the same as the ones you created in MOM 2005.&amp;nbsp; Again, check my TechNet article if you need some help there.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;WMI Event Filter Expressions&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;As discussed in my article, you can specify criteria in the WMI query itself, or you can write a general query and specify the criteria separately.&amp;nbsp; In MOM 2005, that meant specifying criteria in the rule.&amp;nbsp; In OpsMgr 2007, you need to provide a filter expression.&amp;nbsp; The question is how to build it.&lt;/p&gt; &lt;p&gt;The wizard for creating a WMI Event monitor/rule actually won't let you specify no criteria.&amp;nbsp; The Next button won't be active until you provide some entry.&amp;nbsp; If you have a query that doesn't need any filter (which is entirely reasonable), then just specify some bogus filter.&amp;nbsp; Once the monitor/rule is created, open up its properties and delete the filter.&amp;nbsp; It's entirely valid to have a monitor/rule with no filter - the wizard just doesn't let you do it.&lt;/p&gt; &lt;p&gt;If you are going to provide filter, the parameter name needs to be in following format:&lt;/p&gt; &lt;blockquote&gt; &lt;p mce_keep="true"&gt;Collection[@Name='TargetInstance']/Property[@Name=&amp;lt;property name&amp;gt;]&lt;/p&gt;&lt;/blockquote&gt; &lt;p mce_keep="true"&gt;&lt;strong&gt;Example - No Filter&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p mce_keep="true"&gt;We can show this with a simple example.&amp;nbsp; Let's fire the rule when Notepad starts.&amp;nbsp; One method would be to use the following criteria with no filter:&lt;/p&gt; &lt;blockquote&gt; &lt;p mce_keep="true"&gt;SELECT&amp;nbsp;*&amp;nbsp;FROM __InstanceCreationEvent WITHIN 30 WHERE TargetInstance ISA 'win32_process' AND TargetInstance.Name = 'notepad.exe'&lt;/p&gt;&lt;/blockquote&gt; &lt;p mce_keep="true"&gt;&lt;strong&gt;Example - Filter&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p mce_keep="true"&gt;The second option would be to use the following query:&lt;/p&gt; &lt;blockquote&gt; &lt;p mce_keep="true"&gt;SELECT&amp;nbsp;*&amp;nbsp;FROM __InstanceCreationEvent WITHIN 30 WHERE TargetInstance ISA 'win32_process' &lt;/p&gt;&lt;/blockquote&gt; &lt;p mce_keep="true"&gt;with the following filter:&lt;/p&gt; &lt;blockquote&gt;Parameter Name: Collection[@Name='TargetInstance']/Property[@Name='Name'] equals&lt;br&gt;Operator: Equals&lt;br&gt;Value: notepad.exe&lt;/blockquote&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=733962" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/ati/archive/tags/MOM/default.aspx">MOM</category><category domain="http://blogs.technet.com/ati/archive/tags/Scripting/default.aspx">Scripting</category><category domain="http://blogs.technet.com/ati/archive/tags/WMI/default.aspx">WMI</category></item><item><title>WMI Notifications in MOM</title><link>http://blogs.technet.com/ati/archive/2005/12/21/416398.aspx</link><pubDate>Wed, 21 Dec 2005 23:34:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:416398</guid><dc:creator>Brian Wren</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.technet.com/ati/comments/416398.aspx</comments><wfw:commentRss>http://blogs.technet.com/ati/commentrss.aspx?PostID=416398</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Okay, I'm getting tired of answering this question but I have to admit that there is relatively little technical information out there on it.&amp;nbsp;&amp;nbsp;The most common&amp;nbsp;requests I get for MOM scripts are&amp;nbsp;for things like monitoring if a process is running, if a file gets created, if a registry key gets changed, etc.&amp;nbsp; Essentially, these are to monitor some action on the computer that we can't detect through standard MOM providers.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Most of the time,&amp;nbsp;monitoring these actions does not require a script.&amp;nbsp; They can be handled with a relatively simple WMI provider.&amp;nbsp;&amp;nbsp;This is far more efficient than script - easier to create, less overhead on the agent, and way more responsive.&amp;nbsp; Rather than running a script every few minutes to figure out if a process is running for example, I can have a WMI notification&amp;nbsp;tell me when the process terminates.&amp;nbsp; Rather then regularly checking if some file exists, I can have a WMI notification tell me when it gets created.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I have a document that I wrote on this that includes an overview of WMI, methods for writing and testing WMI queries, and a bunch of examples.&amp;nbsp; &lt;A href="http://brianwren.members.winisp.net/WMI/Forms/AllItems.aspx"&gt;Have a look&lt;/A&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=416398" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/ati/archive/tags/MOM/default.aspx">MOM</category><category domain="http://blogs.technet.com/ati/archive/tags/WMI/default.aspx">WMI</category></item></channel></rss>