The Go To Definition command is a neat little command to take you straight to the definition of a module that you are using within a management pack. To show the usefulness of this, here is a little example.
You start building a new MP in VS, and you start writing your registry discovery….
You get to the point where you want to call the Microsoft.Windows.FilteredRegistryDiscoveryProvider to use as a discovery data source, but what configuration items need to be passed to this module?
To find out, simply right click the TypeID, in this case “Windows"!Microsoft.Windows.FilteredRegistryDiscoveryProvider” and select Go To Definition. This will open the referenced management pack in a new tab in VS and take you
straight to that module, where you can view the configuration items required for the module (highlighted in yellow).
Using the Visual Studio Authoring Extensions to build your management packs, one extremely useful piece of functionality is the ability to create multiple rules/monitors/discoveries/tasks/views etc. using management pack template groups. The reason this functionality
is so good is because:
1. Easy to Create
Working with Visual Studio will put a lot of IT Pro's off using the Visual Studio Authoring Extensions, so they have to as easy as possible to use, and the management pack template groups
are certainly easy to create and use! All you need to do to create a new template group is simply right-click in your solution and select Add -> New Item...
and then pick the relevant template...
and then name as required.
2. No XML Required
VSAE adds a UI to create monitoring components such as rules and monitors. Using this UI it is possible to configure all the available settings such as name, target, data source, ID,
description etc etc. and it will configure all the relevant display strings automatically!
--- OK, so I'll be honest here... Sometimes there may be a requirement to work with the XML a little bit. When working with some items, like rules, you need to configure the data source
type the rule is going to use, and usually the data source type will require some configuration items to be passed, and it is this configuration that you will need to configure in the XML. The screen clipping below is displaying the configuration XML for the
data source selected.
This isn't as bas as it seems though, as you can use intellisense to return the configuration items required in the XML. Simply hit Ctrl+Space and the configuration item will be available
to select, as you can see with SyncTime above. Once the SyncTime has been configured, hit return and do Ctrl+Space again to see if another configuration item is required.
3. Copy & Paste
One of my biggest issues with the SCOM 2007 R2 Authoring Console was that it was not possible to copy and paste. In many cases I had the requirement to create tens, if not hundreds,
of rules that were all identical apart from a couple of minor configuration changes, and in the old authoring tool I would have to create each one manually or break out into the XML and copy and paste the relevant rule and display strings. Neither of these
solutions were great as they were both very time consuming, but this issue is now resolved using VSAE as after I have created my first rule, I can simply copy and paste and then simply edit the configuration items as required.
It's not just rules that can be copied and pasted though, any template item can be. The next item below covers all the available template types.
4. 14 Templates Available
5. Auto-Generated MPX
When using template groups, an MPX file is created automatically which enables you to view the XML behind the UI if you so wish.
WARNING: Do not edit the .mpx file as these changes will not be saved.
One of the great features of the SCOM Visual Studio Authoring Extension is the ability to easily view the definitions of content in sealed management packs you are referencing. Sometimes (especially if you are exporting a MP from the SCOM management group
for further customization) you’ll need to reference an MP that is installed in your SCOM management group but that isn’t included in the VSAE package, or isn’t available online. Most likely this is a system MP or a MP that’s only available as part of a bundle
(If your MP contains 2012 dashboards, it’s probably got a reference to Microsoft.SystemCenter.Visualization.Library or Microsoft.SystemCenter.Visualization.Internal). How can you reference these?
Well if you’ve still got your SCOM installation media to hand you can find all of the MPs imported at installation in the ManagementPacks folder. This can be great if you’ve got a required reference, or even just want to have a look at how the product group
implemented some piece of functionality!
Note however that some of the MPs are wrapped up in MPBs (Management pack bundles). It’s still perfectly possible to reference these in your project:
One of the features I love in the Visual Studio Authoring Extensions is IncludeFileContent. This feature enables you to include script files into a management pack, without needing to write the script with the relevant XML tags such as <ScriptBody>.
In MP development up to now, you would need to write your script in the XML of the management pack, like this:
Set oAPI = CreateObject("MOM.ScriptAPI")
Now, with VSAE you can write your script in a VBS, PS1 or JS file just as you would outside of SCOM and then include it in the MP, like this: