My MSN

Click OK to add this content

 
Content Preview: rss
-+Batch Operations in Service Manager 2010 with PowerShell – Removing Instances
32 days ago
Sometimes, when I am developing a demo for Service Manager, I wind up creating a lot of Service Requests or Incidents when I’m trying to get the demo just right. However, after I’ve gotten everything working just like I want and then I give the demo, I don’t really want to have all those earlier things visible because they get in the way of the what I’m trying to show. The Service Manager 2010 provides a way to removing instances from the console, and I could use that, but I like to script everything so I want to create a script instead of using the UI. With this script, I can use this to remove any instance in the CMDB , including Incidents and Service Requests.  Our programming interfaces provide a way to remove instances and I’ve written my script to work a couple of ways: If you provide the script with  ClassName parameter, the script will remove every instance of that class! If you pipe an EnterpriseManagementObject at the script, the script will remove that instance ...
-+Service Manager and the PowerShell 1 liner
52 days ago
I’ve written a number of fairly complicated scripts for Service Manager over the last few months, and while talking to a team-mate about something he wanted to do, it looked like it was just 1-line PowerShell script. That got me thinking about what other things in Service Manager could be handled by a really simple (say less than 5 lines) of PowerShell. The list is good sized, so I thought it would be good if I shared them. The problem we had at hand was how I could help one our development partners figure out in which management pack a particular class resides. It turns out it was 3 lines of script to find out. PS> [reflection.assembly]::LoadWithPartialName("Microsoft.EnterpriseManagement.Core") GAC Version Location --- ------- -------- True v2.0.50727 C:\Windows\assembly\GAC_MSIL\Microsoft.EnterpriseManagement.Core\7.0.5000.0__31bf3856ad364e35\... PS> $EMG = new-object Microsoft.EnterpriseManagement.EnterpriseManagementGroup ...
-+Introducing Management Pack Bundles
81 days ago
Historically, management packs have been comprised of a single XML file (either in XML format in a .xml file or in a binary representation in a signed .mp file). With the new version of the common System Center management pack infrastructure that ships in Service Manager, the definition of a management pack is being extended to include associated “resources” such as images, form assemblies, workflow assemblies, reports, T-SQL scripts, and more. The aggregation of the XML (or even multiple XMLs) plus its associated resources is called a “management pack bundle”. A “management pack bundle” is really a MSI file with a file extension of .mpb (I should tell you that these .msi’s aren’t installable, we’re just using MSI as a file format). These bundles can be imported into Service Manager as a whole through a new MP import interface on the Data Access Service. You can import .mpb files via either the Management Packs view in the Administration workspace in the Service Manager console ...
-+Getting data from Service Manager – a scripted approach
98 days ago
In one of my earlier posts, I said that you needed some C# to get data from Service Manager because of the way some of our methods use generics. It was pointed out to me that I was wrong, wrong, wrong. So I thought I better post a completely scripted approach for retrieving data from Service Manager. The following script will return all instances of the class that’s passed as a parameter. param ( $classname ) $emg = new-object microsoft.enterprisemanagement.enterprisemanagementgroup localhost $class = $emg.EntityTypes.GetClasses() ?{$_.name -eq $classname} if ( ! $class ) { Write-Error "`nERROR: Class '$classname' not found, exiting." exit } $DEFAULT = [Microsoft.EnterpriseManagement.Common.ObjectQueryOptions]::Default $EMOT = [Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject] # Retrieve the interface for EntityObjects, which we'll use when we create our generic method $IMGMT = $emg.EntityObjects.GetType() # the types of the ...
-+Creating Data in Service Manager
101 days ago
In my last post, we saw how we were able to retrieve data from Service Manager, where we also said farewell to scripting.  In this post, I’ll quickly go through how to create instance data in Service Manager.  It was a short farewell to scripting, because unlike the last post were we needed some C# to do what we wanted, we can create most objects in the Service Manager CMDB directly from script.  In order to create instances in Service Manager, we need to use CreatableEnterpriseManagementObject.  The constructor for this object takes a reference to the EnterpriseManagementGroup and a ManagementPackClass.  After this, it’s simply a matter of assigning values to various properties of the object.  Here’s a script that creates 5 instances of Microsoft.Windows.Computer and sets a number of the property values.   $NS = "Microsoft.EnterpriseManagement" $EMGT = "${NS}.EnterpriseManagementGroup" $EMG = new-object $EMGT localhost $CEMOT = ...
© 2009 MicrosoftMicrosoft