<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">BWren&amp;#39;s Management Space</title><subtitle type="html">Operations Manager management packs and other automation technologies</subtitle><id>http://blogs.technet.com/b/brianwren/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/" /><link rel="self" type="application/atom+xml" href="http://blogs.technet.com/b/brianwren/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2009-01-21T08:22:35Z</updated><entry><title>Updated PowerShell Post</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2010/02/01/updated-powershell-post.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2010/02/01/updated-powershell-post.aspx</id><published>2010-02-01T15:38:33Z</published><updated>2010-02-01T15:38:33Z</updated><content type="html">&lt;p&gt;I did a post bacin February 2008 on running a &lt;a href="http://blogs.technet.com/brianwren/archive/2008/02/20/running-powershell-scripts-from-a-management-pack.aspx"&gt;PowerShell script from a management pack&lt;/a&gt;.&amp;#160; This was prior to the native PowerShell modules that came with Operations Manager R2 and that I wrote about &lt;a href="http://blogs.technet.com/brianwren/archive/2009/06/04/powershell-scripts-in-a-management-pack-part-2.aspx"&gt;on a separate post&lt;/a&gt;.&amp;#160; The original information is still valid though since it is the method you need to use if you want to run PowerShell scripts in an SP1 environment.&amp;#160; Until Operations Manager 2007 SP1 is no longer supported, there will be reasons to keep using this method.&lt;/p&gt;  &lt;p&gt;I just had some good feedback sent to me identifying some issues with that original post.&amp;#160; Since I understand that people still refer to that information, I went ahead and modified it to include those corrections.&lt;/p&gt;  &lt;p&gt;Specifically, the following changes have been made:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Changed the command line with the following:&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Set the execution policy&lt;/li&gt;      &lt;li&gt;Add the Arguments parameter &lt;/li&gt;      &lt;li&gt;Fixed some syntax.&amp;#160; &lt;/li&gt;      &lt;li&gt;Fixed the incorrect statement that CDATA cannot be used for the command line. &lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Uses the parameter for IntervalSeconds rather than a fixed value. &lt;/li&gt;    &lt;li&gt;Changes the RequiresOutput element to True. &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3309813" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>New Blog</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2010/01/29/new-blog.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2010/01/29/new-blog.aspx</id><published>2010-01-29T16:45:23Z</published><updated>2010-01-29T16:45:23Z</updated><content type="html">&lt;p&gt;Now that I’ve changed positions to own knowledge for management pack authoring,&amp;#160; a blog more specific that topic was in order. I’ll be moving activities starting today to &lt;a href="http://blogs.technet.com/MPAuthor"&gt;http://blogs.technet.com/MPAuthor&lt;/a&gt;.&amp;#160; Please head over there for announcements on upcoming updates to the MP Authoring Guide and other information regarding MP Authoring.&lt;/p&gt;  &lt;p&gt;Not sure if I’ll be updating this blog or not.&amp;#160; Any MP authoring information will be going on the new blog.&amp;#160; If I have any other topics to talk about, then they’ll go in here.&amp;#160; I’ll certainly keep this one intact though since I have several posts that still have some relevant information.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.technet.com/mpauthor/default.aspx"&gt;MPAuthor Blog&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3309353" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Management Pack Authoring Guide v2</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2010/01/11/management-pack-authoring-guide-v2.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2010/01/11/management-pack-authoring-guide-v2.aspx</id><published>2010-01-11T08:00:25Z</published><updated>2010-01-11T08:00:25Z</updated><content type="html">&lt;p&gt;After 13 years of consulting, I joined the UA team in Redmond last August as a technical writer focusing on management pack authoring.&amp;#160; My initial focus is a new version of the Management Pack Authoring Guide which will provide background concepts, processes, and specific walkthrough examples on creating management packs for Operations Manager 2007. &lt;/p&gt;  &lt;p&gt;The first section of the new Authoring Guide went live last Friday.&amp;#160; This is the section on &lt;a href="http://technet.microsoft.com/en-us/library/ee957010.aspx"&gt;Service Model&lt;/a&gt; which describes classes, relationships, and discoveries.&amp;#160; We have already made significant progress on the Composition section which will be the next to be published.&amp;#160; This will give details on custom modules and workflows and hopefully make everyone confident to select menu items with the word &lt;em&gt;Custom &lt;/em&gt;in the Authoring Console.&amp;#160; This will be followed by sections on Health Model and Presentation (which will primarily talk about Views).&amp;#160; We are also going to get some good reference information in there to help with forming variables and dealing with different data types.&lt;/p&gt;  &lt;p&gt;It’s not common to publish section by section like this.&amp;#160; We would typically complete the entire guide before going live.&amp;#160; It didn’t seem to make any sense to hold back content that people could use immediately though while other sections were being written.&amp;#160; That might have been our only solution back in the days of bound paper manuals, but it certainly doesn’t make any sense in today’s world.&lt;/p&gt;  &lt;p&gt;We’re trying to select the order of publication in terms of demand.&amp;#160; The most common questions that I get are related to the Service Model – what classes to create for an application, what base classes to use, the difference between a base class and a hosting relationship, when to use a containment relationship, etc, etc.&amp;#160; That in addition to the fact that building a model is the first step in building a management pack made it pretty obvious that we needed to get that section published first.&lt;/p&gt;  &lt;p&gt;Please share any feedback you have on the guide – whether it be positive, negative, corrections, suggestions, etc.&amp;#160; If any of the existing content isn’t clear I want to make sure that we make appropriate modifications.&amp;#160; You provide comments on TechNet, on this blog, or by mailing &lt;a href="mail://momdocs@microsoft.com"&gt;MOM Documentation Feedback&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3304795" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>MP Author Resource Kit</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/10/21/mp-author-resource-kit.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2009/10/21/mp-author-resource-kit.aspx</id><published>2009-10-22T06:40:00Z</published><updated>2009-10-22T06:40:00Z</updated><content type="html">&lt;P&gt;I realize I haven’t posted anything in awhile – mainly due to my recent change of job within Microsoft (more information on that later).&amp;nbsp; I had to get off my lazy butt to write this post though because the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9104af8b-ff87-45a1-81cd-b73e6f6b51f0&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9104af8b-ff87-45a1-81cd-b73e6f6b51f0&amp;amp;displaylang=en"&gt;MP Author Resource Kit&lt;/A&gt; was just released today.&amp;nbsp; I’ve had the opportunity to play with a beta of these tools, and they are absolutely outstanding.&amp;nbsp; Some of the tools might be classified under the “nice to have” category but others absolutely change the entire authoring experience.&amp;nbsp; Oh the time that these could have save me over the past couple of years…..&lt;/P&gt;
&lt;P&gt;The rundown of tools in the new resource kit is as follows:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;Authoring Console &lt;BR&gt;&lt;/STRONG&gt;Not too much has changed from the R2 version other than the new resource kit tools getting integrated into the menus. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;MP Best Practices Analyzer &lt;BR&gt;&lt;/STRONG&gt;Scans the management pack to identify where it might deviate from best practices.&amp;nbsp; Even allows automatic resolution for some issues.&amp;nbsp; Don’t underestimate the recommendations made by this tool.&amp;nbsp; These are very current best practices that have been identified from experience and lessons learned since Operations Manager 207 was released. Don’t let an MP out the door until it passes this analysis.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;MP Spell Checker &lt;BR&gt;&lt;/STRONG&gt;Does exactly what the name implies.&amp;nbsp; Cool thing is it allows you to maintain an exclusion list with all those application specific terms you deal with.&amp;nbsp; Nothing like a silly spelling error to make your management pack just look cheesy.&amp;nbsp; No more. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;MP Visio Generator &lt;BR&gt;&lt;/STRONG&gt;Way cool.&amp;nbsp; This creates two Visio diagrams for your service model.&amp;nbsp; One showing class inheritance – all of the base classes that your classes are inheriting from.&amp;nbsp; The other shows the relationships between all of your classes.&amp;nbsp; This is great for documentation of your MP but also nice for analyzing another management pack that you didn’t write.&amp;nbsp; A nice quick diagram of the service model. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;MP Diff&lt;/STRONG&gt; &lt;BR&gt;Shows the differences between two different management packs.&amp;nbsp; Useful for people like me who create all kinds of demo and sample MPs and then forget what the differences are. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Cookdown Analyzer&lt;/STRONG&gt; &lt;BR&gt;Lack of cookdown in rules and monitors targeted at classes with several instances on an agent is one of the biggest sources of overhead from a management pack.&amp;nbsp; This tool will identify classes with the potential for multiple instances and then run an analysis on workflows targeted at them to determine if cookdown may break.&amp;nbsp; &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;All References Add-in &lt;BR&gt;&lt;/STRONG&gt;Right click on any element in a management pack and get a listing of any other referenced elements.&amp;nbsp;&amp;nbsp; Great for quick sanity checks. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Workflow Analyzer&lt;/STRONG&gt; &lt;BR&gt;Finally, a means to debug a running workflow!&amp;nbsp; Connect to an agent, select a workflow and watch the output from each module.&amp;nbsp; This one will be useful to operations people in addition to MP authors.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Workflow Simulator&lt;/STRONG&gt; &lt;BR&gt;I saved the best for last.&amp;nbsp; There simply aren’t enough nice things I can say about this one.&amp;nbsp; Right click on a rule, monitor, or discovery and select Simulate.&amp;nbsp; You’ll actually run a copy of that workflow right on your workstation and be able to inspect the output from each module right there your workstation.&amp;nbsp; No need for a connection to a management group.&amp;nbsp; You could do this on an airplane!&amp;nbsp; We can actually create custom workflows and test them with just the Authoring Console before ever installing the MP.&amp;nbsp; Now this changes the whole process and has the potential to save authors tons of time.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Just to show how cool the Workflow Simulator is, let me show a couple of screenshots.&amp;nbsp; This is the StoreApp management pack that I’ve used at a couple of conferences for a sample.&amp;nbsp; This particular monitor runs a script that collects a file count from several folders – simulating queues in the sample application.&lt;/P&gt;
&lt;P&gt;All I have to do is right click on the monitor and select Simulate.&lt;/P&gt;
&lt;P align=center&gt;&lt;A href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/image_8.png" mce_href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/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/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/image_thumb_3.png" width=667 height=264 mce_src="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P align=left&gt;Then I get a dialog box showing me all of the overrideable parameters in case I want to change any for this simulation.&amp;nbsp; I also get any target variables that are being passed to the monitor.&amp;nbsp; When actually running, these are values that we would get from the properties of the target object.&amp;nbsp; In the simulation though we have no target object, so I get the opportunity to provide my own values.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/10-21-2009%2011-14-10%20PM_2.jpg" mce_href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/10-21-2009%2011-14-10%20PM_2.jpg"&gt;&lt;IMG style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; DISPLAY: inline; BORDER-TOP: 0px; BORDER-RIGHT: 0px" title="10-21-2009 11-14-10 PM" border=0 alt="10-21-2009 11-14-10 PM" src="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/10-21-2009%2011-14-10%20PM_thumb.jpg" width=766 height=356 mce_src="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/10-21-2009%2011-14-10%20PM_thumb.jpg"&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 mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I’m ready, I hit Start Simulation, and the monitor runs - listing each module and it’s output!&amp;nbsp; Have a look at the screenshot below.&amp;nbsp; I have a timestamp next to each module as it is loaded.&amp;nbsp; You can see that the first data source is the scheduler.&amp;nbsp; Once it fires, the script runs outputting three different property bags – one for each folder that my script finds.&amp;nbsp; I then filter that to a single data source matching the particular folder I’m interested in, and then we see each of the expressions for the health states of the monitor.&amp;nbsp; Right next to each module in the Data column, I can see the values in the resulting property bag.&amp;nbsp; If I want to see the actual XML, it’s in the right pane.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/image_14.png" mce_href="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/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/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/image_thumb_6.png" width=757 height=303 mce_src="http://blogs.technet.com/blogfiles/brianwren/WindowsLiveWriter/MPAuthorResourceKit_107A2/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;For anyone who is used to only being able to test workflows by installing them and then waiting for them to deploy to the agent this is huge.&amp;nbsp; An authoring experience not requiring a connection to a running environment, a quick means of testing workflows, and complete exposure into the execution and resulting data from each module in the workflow.&amp;nbsp; What more could you possibly ask for?&lt;/P&gt;
&lt;P&gt;Bottom line – go get the &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9104af8b-ff87-45a1-81cd-b73e6f6b51f0&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9104af8b-ff87-45a1-81cd-b73e6f6b51f0&amp;amp;displaylang=en"&gt;MP Resource Kit&lt;/A&gt; now.&amp;nbsp; I’ve only been using it for a couple of weeks, and I already can’t imagine trying to write an MP without it.&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3288346" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Sample Application for SP1</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/06/04/sample-application-for-sp1.aspx" /><link rel="enclosure" type="text/xml" length="102479" href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-03-25-06-45/Demo.StoreApp.xml" /><id>http://blogs.technet.com/b/brianwren/archive/2009/06/04/sample-application-for-sp1.aspx</id><published>2009-06-05T09:28:00Z</published><updated>2009-06-05T09:28:00Z</updated><content type="html">&lt;P&gt;Attached to this post is a version of my sample application for Operations Manager SP1.&amp;nbsp; This has the process monitor removed that relies on the modules in R2.&amp;nbsp; &lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3250645" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>PowerShell Scripts in a Management Pack Part 2</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/06/04/powershell-scripts-in-a-management-pack-part-2.aspx" /><link rel="enclosure" type="text/xml" length="135222" href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-03-25-06-26/Demo.StoreApp.xml" /><id>http://blogs.technet.com/b/brianwren/archive/2009/06/04/powershell-scripts-in-a-management-pack-part-2.aspx</id><published>2009-06-05T08:49:00Z</published><updated>2009-06-05T08:49:00Z</updated><content type="html">&lt;P&gt;In a &lt;A href="http://blogs.technet.com/brianwren/archive/2008/02/20/running-powershell-scripts-from-a-management-pack.aspx" mce_href="http://blogs.technet.com/brianwren/archive/2008/02/20/running-powershell-scripts-from-a-management-pack.aspx"&gt;previous blog post&lt;/A&gt;, I explained how to run PowerShell scripts from a management pack.&amp;nbsp; I honestly don’t remember why I titled that “Part 1” because I don’t remember what I figured that Part 2 was going to be.&amp;nbsp; Turns out that using the native PowerShell modules in OpsMgr R2 is a perfect topic for Part 2 which I’ll present here (just pretend that I meant that all along).&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Prior to R2 we could launch PowerShell scripts from a management pack, but we had to do it by building the command line and launching powershell.exe.&amp;nbsp; This was more complicated, less efficient, and had the disadvantage that the agent didn’t actually know that it was running a script.&amp;nbsp; If that script hit an error, we didn’t know about because the agent simply knew that it successfully launched the executable.&amp;nbsp; Now that we have a native module, this is going to be much more efficient and reliable.&amp;nbsp; I had some disclaimers in that post about overhead from PowerShell that don’t apply with the new modules.&amp;nbsp; Keep in mind that PowerShell still has to be installed on the target agent.&lt;/P&gt;
&lt;P&gt;There are some different details to know about using these modules though, and that’s exactly the point of this post.&amp;nbsp; I updated my sample application with PowerShell equivalents of a discovery and a property bag script, so you might want to grab that to have as a reference as you read through the rest of this post.&lt;/P&gt;
&lt;H1&gt;Scripts&lt;/H1&gt;
&lt;H3&gt;&lt;/H3&gt;
&lt;P&gt;In the last post I mentioned that the scripts don’t really change from their VBScript counterparts.&amp;nbsp; We still create discovery data and property bags using the MOM.ScriptAPI object – we’ll just need to use the New-Object cmdlet in PowerShell instead of the CreateObject method in VBScript.&amp;nbsp; That’s really the only difference when we were calling PowerShell.exe with the Command, but there are some other changes we’re going to need when using the native R2 modules.&amp;nbsp; &lt;/P&gt;
&lt;H2&gt;Parameters&lt;/H2&gt;
&lt;H3&gt;&lt;/H3&gt;
&lt;P&gt;The first change is how we are going to accept parameters into the script.&amp;nbsp; Note that the term “parameter” is going to get a little tricky here.&amp;nbsp; Modules have parameters, and we can pass parameters to a script.&amp;nbsp; As you’ll see below, the PowerShell modules have a module parameter called Parameter to make things even more confusing.&amp;nbsp; I’ll do my best to keep the wording clear though, and you shouldn’t have too tough of a time sorting all of this out.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I’ll show how to pass the values to the script parameters below, but for now let’s just worry about the script itself.&amp;nbsp; Instead of accessing positional arguments with the $args variable (the equivalent of WScript.Arguments in VBScript) we’re going to use named parameters.&amp;nbsp; We accept these into the script using the param() command at the start of the script specifying the variables that the script is accepting the parameters into.&lt;/P&gt;
&lt;P&gt;For example, for the queue statistics script in my sample application, we need to pass in two parameters - $topFolder and $debug.&amp;nbsp; We do that with the following line:&lt;/P&gt;
&lt;DIV align=center&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;param&lt;/SPAN&gt;($topFolder,$debug)&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P align=left&gt;This would allow us to specify named parameters on the command line when executing the script.&amp;nbsp; This would look something like below for the Queue Statistics script.&lt;/P&gt;
&lt;DIV align=center&gt;&lt;PRE class=csharpcode&gt;.\QueueStats.ps1 -topFolder &lt;SPAN class=str&gt;'C:\StoreQueues'&lt;/SPAN&gt; –debug $false&lt;/PRE&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;We might type that command line when testing the script, but we won’t be putting it into the management pack – I’ll show how we do that below.&amp;nbsp; Just want to give you a basic idea of how PowerShell works with named parameters if you aren’t already familiar with it.&lt;/P&gt;
&lt;H2&gt;Returning Data&lt;/H2&gt;
&lt;P align=left&gt;In VBScript, we return data using the Return method on the MOM.ScriptAPI object if we are returning discovery data or a single property bag.&amp;nbsp; If we are returning multiple property bags, we use ReturnItems().&amp;nbsp; Those aren’t going to work very well from the R2 PowerShell modules though.&amp;nbsp; Instead, we can simply return the objects themselves from the script.&amp;nbsp; In PowerShell, you do this by typing the name of the variable on a line all by itself.&lt;/P&gt;
&lt;P align=left&gt;This is best illustrated by the following examples which show the PowerShell equivalent to a VBScript snippet:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P align=left&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P align=center&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border=0 cellSpacing=0 cellPadding=2 width=681&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;STRONG&gt;Discovery Data&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;VBScript&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;PowerShell&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;PRE class=csharpcode&gt;Set oAPI = CreateObject(&lt;SPAN class=str&gt;"MOM.ScriptAPI"&lt;/SPAN&gt;) 
Set oDiscoveryData = oAPI.CreateDiscoveryData() 
… 
… 
oAPI.Return(oDiscoveryData)&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;
&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;PRE class=csharpcode&gt;$api = New-Object -comObject &lt;SPAN class=str&gt;'MOM.ScriptAPI'&lt;/SPAN&gt; 
$discoveryData = $api.CreateDiscoveryData() 
… 
… 
$discoveryData&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;
&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;STRONG&gt;Single Property Bag&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;VBScript&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;PowerShell&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;PRE class=csharpcode&gt;Set oAPI = CreateObject(&lt;SPAN class=str&gt;"MOM.ScriptAPI"&lt;/SPAN&gt;) 
Set oBag = oAPI.CreatePropertyBag() 
… 
… 
oAPI.Return(oBag)&lt;/PRE&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;PRE class=csharpcode&gt;$api = New-Object -comObject &lt;SPAN class=str&gt;'MOM.ScriptAPI'&lt;/SPAN&gt; 
$bag = $api.CreatePropertyBag() 
… 
… 
$bag&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;



.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;
&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;STRONG&gt;Multiple Property Bags&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;VBScript&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;PowerShell&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD vAlign=top width=347&gt;&lt;PRE class=csharpcode&gt;Set oAPI = CreateObject(&lt;SPAN class=str&gt;"MOM.ScriptAPI"&lt;/SPAN&gt;) 
For Each object &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; collection 
    Set oBag = oAPI.CreatePropertyBag() 
    … 
    … 
Next 
oAPI.ReturnItems()&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;





.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;
&lt;/TD&gt;
&lt;TD vAlign=top width=332&gt;&lt;PRE class=csharpcode&gt;$api = New-Object -comObject &lt;SPAN class=str&gt;'MOM.ScriptAPI'&lt;/SPAN&gt; 
&lt;SPAN class=kwrd&gt;foreach&lt;/SPAN&gt; (object &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; collection) 
{ 
    $bag = $api.CreatePropertyBag() 
    … 
    … 
    $bag 
}&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that in the multiple property bag example, we’re simply returning each bag as we create it. That’s not complicated but certainly a different approach than in VBScript where we stack up all of the objects before returning them at once with ReturnItems().&amp;nbsp; The condition detection or write action that is going to accept the output will work against each property bag returned from the script.&amp;nbsp; The end result is identical to using ReturnItems() in VBScript – just looks a little different in the script.&lt;/P&gt;
&lt;P&gt;&lt;FONT face=ver&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;Consoles&lt;/H2&gt;
&lt;P&gt;The PowerShell modules will not be accessible in the Operations Console in R2 (no word yet if they will be in future releases).&amp;nbsp; You are still going to be limited to writing scripts with VBScript or JScript if you are living only in that console.&lt;/P&gt;
&lt;P&gt;You will be able to use the new modules in the Authoring Console, although wizards aren’t going to be available for them.&amp;nbsp; You aren’t going to be able to simply select New Rule and see something like Timed PowerShell Script.&amp;nbsp; You’re going to have to create custom modules, monitor types, monitors, and rules if you want to use the PowerShell modules.&amp;nbsp; For creating workflows based on scripts this is typically what you want to do anyway to be able to use your script in multiple workflows and to present a nice set of overrideable parameters to the operator.&amp;nbsp; Really shouldn’t be much more complicated than other custom modules that you’ve built. &lt;/P&gt;
&lt;H1&gt;Modules&lt;/H1&gt;
&lt;H2&gt;Discoveries&lt;/H2&gt;
&lt;H2&gt;&lt;/H2&gt;
&lt;P&gt;There is only a single data source module for executing PowerShell scripts -&amp;nbsp; Microsoft.Windows.TimedPowerShell.DiscoveryProvider.&amp;nbsp; This is the functional equivalent of the timed script discovery provider that you’ve probably used for creating a discovery with VBScript.&amp;nbsp; I’m not going to list out all the parameters for the module since you’ll be familiar with most of them – IntervalSeconds, ScriptName, ScriptBody, etc.&amp;nbsp; The new ones are going to be SnapIns and Parameters which I’ll get to below.&lt;/P&gt;
&lt;P&gt;No real trick to using the module other than defining the new parameters.&amp;nbsp; You’ll create a new discovery with that data source, plug in your script, and you’re on your way.&lt;/P&gt;
&lt;H2&gt;Property Bags&lt;/H2&gt;
&lt;P&gt;Scripts returning property bags are used for most monitors and rules using scripts.&amp;nbsp; These are going to be trickier than the discovery scripts using R2 because we don’t have a data source module.&amp;nbsp; We do have a probe action though called Microsoft.Windows.PowerShellPropertyBagProbe, so it’s a matter of creating a data source module using it and a System.Scheduler.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;In the sample application, I have three data source modules for PowerShell property bag scripts as follows:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Demo.StoreApp.TimedPowerShell.PropertyBagProvider &lt;/LI&gt;
&lt;LI&gt;Demo.StoreApp.TimedPowerShell.EventProvider &lt;/LI&gt;
&lt;LI&gt;Demo.StoreApp.TimedPowerShell.PerformanceProvider &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I’m not going to go into the details of each – you can have a look at the them yourself.&amp;nbsp; They are the functional equivalents of the TimedScript modules in the Windows Library management pack.&amp;nbsp; The first returns a property bag while the other two use the first one and then map the property bag output to either an event or perf data.&lt;/P&gt;
&lt;H1&gt;New Parameters&lt;/H1&gt;
&lt;H2&gt;Parameters Parameter&lt;/H2&gt;
&lt;P&gt;Yes I know, a parameter called Parameters – sounds a little tricky.&amp;nbsp; Actually pretty straightforward though.&amp;nbsp; We have a module parameter that defines the script parameters that are going to be passed to our PowerShell script.&amp;nbsp; This replaces the Arguments parameter on the VBScript modules and provides a more structured definition of the arguments being passed to the script.&lt;/P&gt;
&lt;H2&gt;&lt;/H2&gt;
&lt;P&gt;The other thing that’s going to make this a bit tricky is that we’re going to have to directly edit the XML in order to provide the parameters.&amp;nbsp; The structure is pretty simple, but you may not be familiar with launching an external editor from the Authoring Console.&amp;nbsp; I’m not going to go into the details of that here, but I may do another blog post on it.&amp;nbsp; It may seem a bit confusing how to do this and also why you have to.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;The structure is pretty simple as you can see from the example below – just a matter of providing a name and value for each parameter.&amp;nbsp; This is for the queue discovery in my sample application.&lt;/P&gt;&lt;PRE class=csharpcode&gt;&amp;lt;Parameters&amp;gt; 
  &amp;lt;Parameter&amp;gt; 
    &amp;lt;Name&amp;gt;sourceID&amp;lt;/Name&amp;gt; 
    &amp;lt;Value&amp;gt;$MPElement$&amp;lt;/Value&amp;gt; 
  &amp;lt;/Parameter&amp;gt; 
  &amp;lt;Parameter&amp;gt; 
    &amp;lt;Name&amp;gt;managedEntityID&amp;lt;/Name&amp;gt; 
    &amp;lt;Value&amp;gt;$Target/Id$&amp;lt;/Value&amp;gt; 
  &amp;lt;/Parameter&amp;gt; 
  &amp;lt;Parameter&amp;gt; 
    &amp;lt;Name&amp;gt;topFolder&amp;lt;/Name&amp;gt; 
    &amp;lt;Value&amp;gt;$Target/Property[Type=&lt;SPAN class=str&gt;"Demo.StoreApp.ComputerRole.CentralServer"&lt;/SPAN&gt;]/QueuePath$&amp;lt;/Value&amp;gt; 
  &amp;lt;/Parameter&amp;gt; 
  &amp;lt;Parameter&amp;gt; 
    &amp;lt;Name&amp;gt;computerName&amp;lt;/Name&amp;gt; 
    &amp;lt;Value&amp;gt;$Target/Host/Property[Type=&lt;SPAN class=str&gt;"Windows!Microsoft.Windows.Computer"&lt;/SPAN&gt;]/PrincipalName$&amp;lt;/Value&amp;gt; 
  &amp;lt;/Parameter&amp;gt; 
  &amp;lt;Parameter&amp;gt; 
    &amp;lt;Name&amp;gt;debug&amp;lt;/Name&amp;gt; 
    &amp;lt;Value&amp;gt;$true&amp;lt;/Value&amp;gt; 
  &amp;lt;/Parameter&amp;gt; 
&amp;lt;/Parameters&amp;gt; &lt;/PRE&gt;
&lt;STYLE type=text/css&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;P&gt;The first line of the script this module would be calling is the following Param command which collects each of the named parameters.&lt;/P&gt;
&lt;P align=center&gt;&lt;FONT face="Courier New"&gt;param($sourceId,$managedEntityId,$topFolder,$computerName,$debug)&lt;/FONT&gt;&lt;/P&gt;
&lt;P align=left&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H2&gt;Snap Ins Parameter&lt;/H2&gt;
&lt;P&gt;The other parameter is to define snap ins that your script requires.&amp;nbsp; Your script may not need any in which case you won’t use this parameter.&amp;nbsp; I don’t have in my sample application since those scripts just use the file system.&amp;nbsp; To show an example of the parameter though, consider a script that requires access to Operations Manager data – something you might run from a Management Server.&amp;nbsp; That would require the client snap-in which is called Microsoft.EnterpriseManagement.OperationsManager.Client.&amp;nbsp; To specify this snap-in for your script, you would use the following &lt;/P&gt;&lt;PRE class=csharpcode&gt;&amp;lt;SnapIns&amp;gt;
  &amp;lt;SnapIn&amp;gt;Microsoft.EnterpriseManagement.OperationsManager.Client&amp;lt;/SnapIn&amp;gt;
&amp;lt;/SnapIns&amp;gt;&lt;/PRE&gt;
&lt;H2&gt;Samples&lt;/H2&gt;
&lt;P&gt;Rather than paste a bunch of XML in here, you can just grab the latest version of the sample application attached to the post.&amp;nbsp; I have a discovery script and property bag script in there that have plenty of comments.&amp;nbsp; I haven’t updated the document yet, but I’ll get to that.&amp;nbsp; I didn’t want to hold off on the post.&lt;/P&gt;
&lt;STYLE type=text/css&gt;


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3250626" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Sample Application Dependencies</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/05/19/sample-application-dependencies.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2009/05/19/sample-application-dependencies.aspx</id><published>2009-05-20T08:25:00Z</published><updated>2009-05-20T08:25:00Z</updated><content type="html">&lt;p&gt;I’ve had a couple of people tell me that the sample application I used for my MMS presentations won’t load in their environment.&amp;#160; That’s because the management pack requires the OpsMgr R2 beta.&amp;#160; It won’t load into an SP1 management group.&amp;#160; I used a monitor in there from the new process monitoring MP in R2.&amp;#160; &lt;/p&gt;  &lt;p&gt;I’m about to update the MP with some PowerShell examples.&amp;#160; When I do, I’ll strip out the process monitoring in the original version and have a second version that can load into SP1 for those people without access to an R2 environment. Should just be a couple of days before I get that done.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3243596" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>R2 Authoring Console</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/05/07/r2-authoring-console.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2009/05/07/r2-authoring-console.aspx</id><published>2009-05-07T19:16:29Z</published><updated>2009-05-07T19:16:29Z</updated><content type="html">&lt;p&gt;I’ve been getting this question quite a bit, so I thought I’d give a quick answer to it.&amp;#160; The question is whether we can use the R2 Authoring Console to create management packs for SP1.&amp;#160; The answer is that you absolutely can – with a minor caveat.&amp;#160; There is nothing different about the structure of a management pack for SP1 or R2, and the Authoring Console just creates management packs in XML.&amp;#160; There are R2 specific modules, and using those will make your MP unusable in SP1, but you could use those with any version of the Authoring Console or even editing XML directly.&lt;/p&gt;  &lt;p&gt;But what about that one caveat?&amp;#160; When you create a new management pack in the Authoring Console, it will automatically add references to the library MPs – System.Library, System.Health.Library, Microsoft.Windows.Library, and Microsoft.SystemCenter.Library.&amp;#160; The R2 Authoring Console will create those references to the latest versions of those MPs (6.1.7043.0 as of RC version of R2).&amp;#160; You probably aren’t going to use any specific features of those new versions, but if you leave those references, your management pack won’t load in a management group with pre-R2 libraries.&amp;#160; &lt;/p&gt;  &lt;p&gt;To fix this, you should be able to just go to the References tab in Management Pack Properties and change the versions of those references.&amp;#160; The Key Token won’t change since the same certificate was used for sealing the different MP versions.&amp;#160; For reference, the SP1 libraries are version 6.0.6278.0, and the RTM libraries are version 6.0.5000.0.&lt;/p&gt;  &lt;p&gt;Bottom line is definitely use the R2 Authoring Console regardless of which version of OpsMgr you’re working with.&amp;#160; Several improvements over the SP1 version including the ability to create elements that we used to have to drop out to XML for.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3236983" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>MMS 2009</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/04/28/mms-2009.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2009/04/28/mms-2009.aspx</id><published>2009-04-29T03:44:43Z</published><updated>2009-04-29T03:44:43Z</updated><content type="html">&lt;p&gt;A bit wiped out after delivering four consecutive sessions on management pack authoring.&amp;#160; I'm impressed with people who made it through the entire five hours.&amp;#160; That was definitely not light content.&amp;#160; Seems like they were well received though.&amp;#160; &lt;/p&gt;  &lt;p&gt;The sample management&amp;#160; pack that I showed along with a document describing&amp;#160; the MP and the sample application that it's based on is on the &lt;a href="http://www.opsmanjam.com/Lists/OpsManJam%20Announcements/DispForm.aspx?ID=13"&gt;OpsManJam&lt;/a&gt; site.&amp;#160; I'm planning on continuously updating this MP as l create other example scenarios.&amp;#160; I thought that would be more interesting than continuing to do random examples, and l can keep them all packaged up in one clean MP.&amp;#160; I'm also getting tired of all the random little XML files l have cluttering up my MP library.&lt;/p&gt;  &lt;p&gt;I'm getting mocked quite a bit at the conference about my lack of blog updates.&amp;#160; Now that I've gotten through these presentations as well as some other training l was working on, l should be able to get to that.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3232238" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>SNMP Queries</title><link rel="alternate" type="text/html" href="http://blogs.technet.com/b/brianwren/archive/2009/01/21/snmp-queries.aspx" /><id>http://blogs.technet.com/b/brianwren/archive/2009/01/21/snmp-queries.aspx</id><published>2009-01-21T19:22:35Z</published><updated>2009-01-21T19:22:35Z</updated><content type="html">&lt;p&gt;I recently help someone out getting a monitor working that uses the System.SnmpQueryProvider module in the System.Snmp.Library management pack to perform a query against an SNMP device.&amp;#160; They were getting back an error message showing some cryptic characters in the community string.&amp;#160; They were just providing simple text like &amp;quot;public&amp;quot; for the CommunityString parameter on the module, so this looked pretty strange.&lt;/p&gt;  &lt;p&gt;After some research, it turns out that module wants the community string specified in Base64 format.&amp;#160; Nothing special from the MP perspective – you just need to specify the Base64 equivalent of your community string in the CommunityString parameter rather than the simple text.&lt;/p&gt;  &lt;p&gt;If you already have a means of converting a string to Base64, then you should be fine.&amp;#160; If not, here’s bit of PowerShell that will do the conversion for you.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;$communityString = &lt;span class="str"&gt;'public'&lt;/span&gt;
[System.Convert]::ToBase64String([System.Text.Encoding]::UNICODE.GetBytes($communityString))&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If I run that code, I get the following value: cAB1AGIAbABpAGMA.&amp;#160; Pasting that into the CommunityString parameter on the module should get you the results you want.&amp;#160; Obviously, if you have a community name different than &amp;quot;public&amp;quot; you would paste that in and use the resulting converted value.&lt;/p&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3188530" width="1" height="1"&gt;</content><author><name>Brian Wren</name><uri>http://blogs.technet.com/Brian-Wren/ProfileUrlRedirect.ashx</uri></author><category term="OpsMgr" scheme="http://blogs.technet.com/b/brianwren/archive/tags/OpsMgr/" /><category term="Management Packs" scheme="http://blogs.technet.com/b/brianwren/archive/tags/Management+Packs/" /></entry></feed>