Creating custom reports in SCSM
Hello,
Creating reports is not an easy task; in System Center Service Manager this task is not simplified, you need to have some SQL reporting knowledge to be able to build them. If we take the deployment of the custom reports via management pack into account it is even more difficult to go through the procedure and successfully deploy the reports.
This blog will explain how you can build custom reports that are based on an existing report of Service Manager. The following steps need to be taken in order to get the custom reports working in the SCSM console, without deploying them via mgmt pack:
- - SQL stored procedure (SP) will need to be adjusted to include the necessary values.
- - Report needs to be adjusted to have the additional columns of information.
- - SQL Stored Procedure and reports need to be deployed.
Next procedure will guide you through the steps to create a custom report. The “list of changes” report will be used as base report for the example report that will be build in this procedure. This report will be adjusted to include all Review Activities that are part of the Change. Let’s start…
Creating/updating the SQL stored procedure
Navigate in the SQL Management Studio to the DWDataMart Database, expand Programmability folder, expand Stored Procedures folder
Right click on the “ServiceManager_Report_ChangeManagement_SP_GetListOfRFCs_Install” SP, select Script Stored Procedure as, select CREATE To and select New Query Editor Window.
The query will be opened in a new pane, you need to adjust the name of the SP before you can execute the creation and start modifying the SP. For this procedure the name is adjusted to:
CREATE PROCEDURE [dbo].[ServiceManager_Report_ChangeManagement_SP_GetListOfRFCs_WithActivities]
After changing the name you can start modifying the SP. To get the needed information in the SP you need to update the “SELECT”, “FROM” and “WHERE” sections in the Query. Right click on the new created SP and select Modify. For the example report that will be created we need to have to include review activity information. This code is added in the FROM of the query to get this additional information.
The SELECT section in the query is updated to include the additional values.
In the WHERE section of the query you can filter the information. A filter on the ActivityType can be added to exclude these kind of activity entries in the report. Following code is added in the example query:
ActivityType.DisplayName NOT LIKE (‘%Extension%’)
All changes for the example SP are made and the query can be executed. This will make the changes in the SP, the only thing that need to be done is to make sure that reportuser role in SQL can execute the SP. click on the new created SP, and select Properties.
- - Select Permissions, in the Permissions pane click on Search button
- - Add “reportuser” in the selected objects (check names), click OK
- - Grant Execute rights for the report user
All done for this part.
As you can read, the information you need to add in the query is depended on what you need to present in the report. This example is getting the review activities, another could be to get all Incidents that are related to the Change. The same procedure can be applied to other mgmt function reports. Copy the SP, modify the query and update permissions.
To test your SP you need to remove the parameter information from the query. Click Modify on the SP you have created. In the begin of the SP you need to remove All “@” and DECLARE lines. Your SP should look like this:
In the WHERE section of the SP you can remove all parameter information, you own filters can stay in the SP.
Execute the query in order to update the SP. After this update you should be able to execute and test your SP. Once you have finished testing, you can copy and paste the parameter information back in your SP. Click Modify on the SP, copy the parameter information from your “source” SP and execute the query. In this way your SP includes the needed information for SCSM reporting.
SCSM custom report creation
To create the custom report you can use the same approach. Start from an existing report, adjust the SP and update the column definition to include the needed information. Run through next procedure to create a custom report.
Start Report Builder and open an existing report. Navigate to your reportserver website (http://<YourServer>/ReportServer) and browse to the “source” report. In this example the following reporting is used as starting point for the custom report: ServiceManager.Report.ChangeManagement.ListOfRFCs
In the Report Data pane (left of the Report Builder console), expand Datasets and right click on the Table_RFC dataset, select Dataset Properties.
On the Query page of the Dataset properties update the dataset to point to the new created SP. Select the new SP in the Select or Enter stored procedure name dropdown (ServiceManager_Report_ChangeManagement_SP_GetListOfRFCs_WithActivities)
Click on the Refresh Fields button and click Ok.
The fields in the dataset should be updated with the additional fields defined in the selected SP.
If you haven’t done it yet, save your report with another name on the report server. (The example report is saved as “Changes with Activities list”)
Now you can update the columns in the report. For this report we don’t need all time information, these columns can be deleted. The Activity Id, status and activity type columns need to added. To do this you can right click and select Delete Columns to remove the unneeded columns. Right click on the last column, select Insert Column and click Right to add columns.
In the new column, hover over the white space of the column (an icon should appear in the upper right of the white area) and click on the icon. The list of dataset properties pops-up from where you can select the property to bind in to the report column. Same steps need to be taken to include the other properties from the dataset. Final result for the example report is illustrated below.
Save the report to the SQL report server. At this point we have all SQL reporting configuration done if we want to deploy the report with a management pack. The detailed procedure how to do this is explained here.
The purpose of this blog is to illustrate how you can deploy the custom reports without management pack. The missing part in this solution is the Report Parameter Definition Language (.rpdl) file for the custom report. This is not a difficult part; on the SQL reporting server (in this case the ‘”ListOfRFCs” report) download the .rpdl file from the source report and rename this file to the same name as the new report. Upload the file in the same directory on the reporting server.
Both files are now on the report server and the job is done.
Report in SCSM console (restart your SCSM console if the report is not directly appearing in the folder)
All “default” report parameters are included in the report
Report created and working!
SQL Stored Procedure and report deployment
If you deploy the reports via management pack then you don’t need any additional steps to get the reports working in another environment. All is done via the MP deployment. In this procedure the SP, report and Report Parameter Definition Language (rpdl) file needs to be downloaded and uploaded in the new environment. For example if you are building your reports in a development environment and need to get them in the production environment.
Stored Procedure
Via SQL management Studio you can create a deployment script. Right click on the SP, select Script Stored Procedure as, Select CREATE TO and click on File… Provide a name for the query and click on Save.
This file can be used to deploy the SP in another environment.
Report and Report Parameter Definition Language file
You can download the files from the reporting server. The report file needs to be adjusted to point to the correct reporting server (all this is done if you deploy via MP. I need to check if we can avoid this step…). Open the report file (rdl) and navigate to the end of the file. Update the ReportServerUrl tag in the file with your reporting server.
Create the SP via the file, upload the report files and custom report is deployed!
Hope this helps creating you own report in SCSM. I like the cube functionality, but in a lot of deployments the people want to have it in a standard report. Following the procedure in this blog you can easily create and update custom reports without the need to delete/import a management pack.
Have Fun!!
Kurt Van Hoecke
SCSM–SCOM Business Service Extension
With the integration of SCOM and SCSM we can leverage our DA (Distributed Applications) created in SCOM into SCSM. Which is great but how can you extend the properties of a Business Service?
When you first start with this synchronization the first part you get stuck would be how to setup the connection which is a different topic. This post will describe what to do when you have your Services in SCSM and want to add custom properties to these services.
This post is created and dedicated to the famous Anders Asp
http://www.scsm.se/ aka. @SCSMSE (Famous…Yes!….They even named a framework after him
)
Understanding the “Business Service” in SCSM When you look at the business services in SCSM it all looks really simple, right?
You can either create the Business Service Manually from within SCSM or synchronize them form SCOM. It is the same, right?
Well for the end users yes they are the same! But for us the guys needing to create extensions add forms, and eating XML…..that’s another story:
To answer this question you need to open up the MP’s and put on your XML gear and dive in!
To understand what exactly happens on the back ground I have added the class structure. The figure below shows the classes the top is the base class “Object” below are all “child” classes al the way to the business service:
This is the structure let’s take a look at SCSM and synchronize a Distributed Application from SCOM to SCSM.
After checking the DA was synchronized now create a second “Business Service by clicking the Task “create Service”.
When you review the Business Service View from the SCSM console you see 2 “Business Services”.
This all looks really transparent, right? Or maybe there something more to it? Yes up until now this is what a user would experience. To the user this is all transparent and he will see 2 business services.
This is perfectly correct since to the user a business service is a business service. From our world as authoring freaks there is far more to it.
Let’s take a look how it really is designed in SCSM:
Unlike what it looks like to the user above picture shows how all components really live in SCSM. This is where the difference between both components lives, I will explain each component:
Business Service View
The view in SCSM is target at System.Service which makes it possible to show both child classes beneath the System.Service Class. This gives the console user the experience of looking at one “Business Service”. While in reality he is looking at multiple classes.
SCOM Distributed Applications Synchronized
In SCOM a Distributed application “Manually created in SCOM” lives in the class User Created Distributed Application. (Not manually created, really depends on the management pack. Most of the times it will live as a system.service. But this will bring in the same problem.)
SCSM Business Service Manually created
A manually created Business Service in SCSM (Created by the task “Create Service”) will live as a business service in SCSM.
Now why did they create a new class Business Service Class?
Why didn’t they re-used the already existing class and extended this one?
The answer to both these questions lies a little deeper and to understand you need to really examine the classes and their properties.
First remember an abstract class is not extendable nor can you add an abstract class instance manually in SCSM!
The picture below shows you exactly which classes are abstract and which are not. So basically state which classes you can extend and which classes you cannot extend:
Now you understand why they needed to create the extra class. All other classes are abstract and therefore you cannot create an instance of this class from SCSM by using the task “Create Service” nor can you extend them.
So basically you cannot extend the Distributed applications which are synchronized from SCOM!
This is a fact which we cannot change but there are solutions to work around this problem.
I will describe the solution to “Extend” the Synchronized DA’s from SCOM!
Extend Synchronized Business Services From SCOM
Since we cannot really extend the abstract class we are going to create a solution which is based on a new class and a type projection.
For extra read on type projections I strongly recommend reading below and just test:
Travis Wright – Creating Queues and Groups Using Type Projections
Travis Wright – Having More Fun with Type Projections Using ObjectProjectionCritera
The end goal is again a transparent solution to the user looking at the business services.
Here is the end result shown where the end user or service desk employee using the console experiences a single form with extended properties:
Create Extended.Business Service Class
Open the Authoring console and create a new Class with the following properties :
Make Sure the relationship “ExtendedBusinessRelatesToService” has a Source Max Cardinality of 1.
This is required to be able to use this relationship in a later phase.
Create a custom form for this class:
You have now created a Management pack with a new class and properties.
Trick the Default Service Form with a Type Projection
Next we are going to edit the default Service Form.
Simply edit the default Service Form in the Authoring Console and add an extra Tab Item containing extra properties, just add them don’t bind them to targets yet:
After creating this form in your management pack, save the management pack and close the authoring console.
Now we are going to extend the Type projection target at the customized service form by using a XML editor.
In the XML there are two type projections and two forms:
<TypeProjection ID="Extended.Business.Service.Form_TypeProjection" Accessibility="Public" Type="ExtendedBusinessServiceClass">
<TypeProjection ID="CustomForm_8a075e3c_dd8f_4b29_9e63_d73c2c76ee0d_TypeProjection" Accessibility="Public" Type="System!System.Service">
<Form ID="Extended.Business.Service.Form" Accessibility="Public" Target="Extended.Business.Service.Form_TypeProjection" Assembly="CustomFormTemplates" TypeName="CustomFormTemplates.HistoryOnlyTemplate">
<Form ID="CustomForm_8a075e3c_dd8f_4b29_9e63_d73c2c76ee0d" Accessibility="Public" Target="CustomForm_8a075e3c_dd8f_4b29_9e63_d73c2c76ee0d_TypeProjection" BaseForm="Alias_c47dbffb_8a79_48d7_a8d0_62b94f82d77f!ServiceMainForm" TypeName="Microsoft.EnterpriseManagement.ServiceManager.ServiceMaps.Forms.ServiceForm">
We need to focus on the Type Projection which is used in the ServiceMainForm, the form for viewing Services.
We are going to change this type projection to include our new class, After changing the Type Projection we can use the authoring tool to add the bindings.
<TypeProjection ID="CustomForm_8a075e3c_dd8f_4b29_9e63_d73c2c76ee0d_TypeProjection" Accessibility="Public" Type="System!System.Service">
<Component Path="$Context/Path[Relationship='Alias_4631e730_74bb_49f3_9a11_d8ab92b69348!Microsoft.SystemCenter.ServiceDesigner.ServiceHasGroups']$" Alias="ServiceHasGroups" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemContainsConfigItem' SeedRole='Target']$" Alias="UsedBy">
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target' TypeConstraint='Alias_ce17648b_cb08_4401_8e4c_73099262a0ae!System.WorkItem.Incident']$" Alias="AffectedByIncidents" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target' TypeConstraint='Alias_c5b0afe9_4b97_478b_af44_b878af41a801!System.WorkItem.ChangeRequest']$" Alias="AffectedByChanges" />
</Component>
<Component Path="$Context/Path[Relationship='System!System.ConfigItemOwnedByUser']$" Alias="ComponentServiceOwners" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemServicedByUser']$" Alias="ComponentServiceContacts" />
<Component Path="$Context/Path[Relationship='System!System.ServiceImpactsUser']$" Alias="ComponentImpactedByService" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemImpactsCustomers']$" Alias="ComponentBusinessCustomers" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemRelatesToConfigItem' SeedRole='Target']$" Alias="ImpactedWorkItem" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target']$" Alias="RelatedWorkItem" />
<Component Path="$Context/Path[Relationship='Alias_e5d6f5cf_62d1_4210_bbdf_f67e3239c646!System.ConfigItemHasFileAttachment']$" Alias="FileAttachment" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemRelatesToConfigItem']$" Alias="RelatedConfigItem" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemRelatesToConfigItem' SeedRole='Target']$" Alias="RelatedConfigItemSource" />
<Component Path="$Context/Path[Relationship='Alias_a34c42e2_3c61_4218_bb7f_31888ba93501!System.EntityLinksToKnowledgeDocument']$" Alias="RelatedKnowledgeArticles" />
</TypeProjection>
Above is the entire type projection. we are going to add our newly created relationship to this type projection:
<Component Path="$Context/Path[Relationship='ExtendedBusinessServiceRelatesToService' SeedRole='Target']$" Alias="ExBusinessServiceRelatesToService">
<Component Path="$Context/Path[Relationship='Tech1']$" Alias="Tech1RelatesToExBusinessService" />
</Component>
The complete Type Projection will be:
<TypeProjection ID="CustomForm_8a075e3c_dd8f_4b29_9e63_d73c2c76ee0d_TypeProjection" Accessibility="Public" Type="System!System.Service">
<Component Path="$Context/Path[Relationship='Alias_4631e730_74bb_49f3_9a11_d8ab92b69348!Microsoft.SystemCenter.ServiceDesigner.ServiceHasGroups']$" Alias="ServiceHasGroups" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemContainsConfigItem' SeedRole='Target']$" Alias="UsedBy">
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target' TypeConstraint='Alias_ce17648b_cb08_4401_8e4c_73099262a0ae!System.WorkItem.Incident']$" Alias="AffectedByIncidents" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target' TypeConstraint='Alias_c5b0afe9_4b97_478b_af44_b878af41a801!System.WorkItem.ChangeRequest']$" Alias="AffectedByChanges" />
</Component>
<Component Path="$Context/Path[Relationship='System!System.ConfigItemOwnedByUser']$" Alias="ComponentServiceOwners" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemServicedByUser']$" Alias="ComponentServiceContacts" />
<Component Path="$Context/Path[Relationship='System!System.ServiceImpactsUser']$" Alias="ComponentImpactedByService" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemImpactsCustomers']$" Alias="ComponentBusinessCustomers" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemRelatesToConfigItem' SeedRole='Target']$" Alias="ImpactedWorkItem" />
<Component Path="$Context/Path[Relationship='Alias_b97cdc42_d94e_4c0e_ba0c_a0b3af25ff3e!System.WorkItemAboutConfigItem' SeedRole='Target']$" Alias="RelatedWorkItem" />
<Component Path="$Context/Path[Relationship='Alias_e5d6f5cf_62d1_4210_bbdf_f67e3239c646!System.ConfigItemHasFileAttachment']$" Alias="FileAttachment" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemRelatesToConfigItem']$" Alias="RelatedConfigItem" />
<Component Path="$Context/Path[Relationship='System!System.ConfigItemRelatesToConfigItem' SeedRole='Target']$" Alias="RelatedConfigItemSource" />
<Component Path="$Context/Path[Relationship='Alias_a34c42e2_3c61_4218_bb7f_31888ba93501!System.EntityLinksToKnowledgeDocument']$" Alias="RelatedKnowledgeArticles" />
<Component Path="$Context/Path[Relationship='ExtendedBusinessServiceRelatesToService' SeedRole='Target']$" Alias="ExBusinessServiceRelatesToService">
<Component Path="$Context/Path[Relationship='Tech1']$" Alias="Tech1RelatesToExBusinessService" />
</Component>
</TypeProjection>
Now save the XML and open the authoring console again.
Now you can add the bindings to the ServiceMainForm, just select the field and select the “…” to browse for the property you want to use:
Notice how you can now traverse the relationship “ExtendedBusinessRelatesToService” to select properties of our custom class.
Select the correct binding paths for all fields.
The path to the TECH 1 user you need to add this manually and can’t use the browse function wen using this binding path. This is because this relationship is three layers deep.
Just add the binding path like “ExBusinessServiceRelatesToService.Tech1RelatesToExBusinessService”.
This binding path now travels over the first relationship from Service To Extended Service (ExBusinessServiceRelatesToService) and two the second realtionship Extended Service clas to User (Tech1RelatesToExBusinessService).
After this you can save the management pack and seal it.
Now you can import the management pack in your environment,
Create a view for your new Class.
Create a Class and relate it to an existing business service.
And now you are finished:
Recap
This post describes how to “extend” a business Service in SCSM.
The idea behind it is you grant your CMDB manager rights on the Extended Service View and instruct him how to create this class and link it to an business service.
The other users using the console don’ have access to this view and this solution will be transparent to them. They experience simple editing and adding of custom properties to business services.![]()
If you want this even fancier you could create a task to add the custom class and link them to a business service or use orchestrator to automatically create these for you !![]()
The example used uses a solution to show history tab, required for auditing purposes from Patrick Sundqvist – Part 1: Custom Form Templates for Service Manager 2012
Happy Authoring,
Oskar Landman
SCSM showcase: Incident & Request Intake task
Hello,
This blog describes an example solution to demonstrated the customization capabilities of System Center Service Manager – a customization show case. The creation of the described solution started with a request of a customer and feedback on the out-of-the-box functionality I have received. The following functionality request and feedback was the start point for the creation of the SCSM Intake task:
- - Cascading dependencies should be available for the intake of an Incident or Request.
- - It should be possible to display knowledge article information while service desk is completing the intake of a request.
- - It must be possible to directly resolve the work item.
These functionalities can really have an added value for the intake of a request. In my solution and answer on the desired functionality I enable the following capabilities in the Service Manager console via a custom task:
- - Service/Incident managers can enforce their process; impact and urgency can be set based on the selections made in the cascading dependencies dropdown list boxes.
- - Service desk analyst does not always know the Incident routing information. The routing configuration can be set for the selections and based on the selections made in the form the correct support group is set.
- - Intake configuration of the cascading dependencies is made in the Library workspace. Customers can apply their own settings for the intake of the requests.
An overview of my solution:
- I have created a custom task for the intake of an Incident. The default Incident form is not replaced, after the intake of the request the analyst make use of the default forms in Service Manager. Service, Component and Symptom are custom configuration item classes. Views and forms are there to create and configure the intake settings in the Library workspace. Below a screenshot of the “symptom” form. Some explanation around this configuration:
- - Display name: displayed selection in the form
- - ID’s: currently the cascading dependencies configuration is based on ID’s. This will be changed to relationships to ease up the configuration of the functionality.
- - Impact, Urgency and support group are set on the work item when selected
- - Knowledge article that is presented when selected.
- In the solution that I have build there is a four level selection, as you can see in figure below. The selection to create an Incident or request can be made in the two checkboxes. Classification Category, Service, Component and Symptom displayed items are depended on the selection you make in the list box above. For example, you will only see components from the service you have selected.
- 1. Items in the drop down are enumerated from the custom classes that are created and configured in the library workspace. List boxes with cascading dependencies : each selection defines what will be presented in the next drop down.
- 2. Last selection sets the support group, Impact and Urgency on the work item.
- 3. Each drop down item can have a related knowledge article. This is presented to the analyst. Can be a questionnaire or simply input for resolution…
The complete intake task I have build includes:
- - User pickers to specify Affected user and reporting user.
- - Affected user his devices (primary owner & User uses device) are listed in the “Affected configurations items” drop down. Other can be searched via the buttons next to the list view.
- - Via the “Assistance” button a remote assistance session can be started to the specified computer.
- - Files can be added…
- - Incidents can be submitted and also directly resolved.
This is an example solution that is created for a customer. As you can see, if it’s not in the product you can build it your self ![]()
Have fun customizing SCSM on AuthoringFriday!
Kurt Van Hoecke
SCOM: Input and Pass user input parameters to Console Task
This is a small thing I figured out to request user input and pass it as a parameter to a console task by using PowerShell.
Issue:
The client wanted to be able to create tickets from an alert in the console if they were missed by an operator or notification script. The notifications pass the different parameters to a PowerShell script that generates the ticket. So far so good. But they wanted to call the notification from a Alert Console task. There are different parameters that need to be customized per alert to generate the correct ticket. One option was to create an Alert Console task for ALL the different classifications of alerts which would be a nightmare from manageability perspective + clutter the console.
Solution:
I came up with a small PowerShell script which will ask the user for input and use that input to generate the ticket with the correct info. The user still needs to know what to fill in but still it’s better than creating all the different Alert Console tasks.
This script is reusable in all your scripts you need to make interactive so you can prompt users for input during a console task.
Example:
In this example I’ve created a small Alert Console Task to connect to a Remote server via Remote desktop connection which can be different than the server which is generating the alert you’ve selected.
The PowerShell script I used in this example can be downloaded here
1. Creating the console task:
First things first. We need to create the console task.
Navigate to the Authoring pane > Management pack objects > tasks > create new task.
In the selection window select a Console Task > Alert Command line (This is necessary if we want to pass parameters from the alert to the script we would like to run)
Name your task.
Note: This will be the actual name which will appear in your console so keep it short and simple but clear enough so someone will know what the task will do.
Note: I’ve created a separate management pack for all my Console Tasks
Specify the command line options:
- Application: %windir%\system32\windowspowershell\v1.0\Powershell.exe
- Parameters: C:\scripts\consoletask\remotedesktop.ps1 $ID$ “$Managed Object Name$"
- Working Directory: c:\scripts\consoletask\
Note: The script must be copied to the local computer where the console is installed. In this case: c:\scripts\consoletask\
Hints:
- If you want to check what alert parameters you can pass to your script click the arrow behind the parameters field
- Keep the “Display output when this task is run ticked as this is a great tool to check whether there are issues with your script during execution. If you are convinced after testing that the task is working you can change it to hidden.
2. Check the Console Task
When saved, the Task will appear between the Alert Tasks in the task pane when you select an alert.
When you click the task the Console Task Output window will pop up together with a window asking the user to put in a servername. If the user clicks cancel the task is terminated.
Success! The remote connection is started with the server we have put in!
3. Disable the Output window
Now that we have verified everything is working we can disable the task console window so only the prompt for input is shown.
Open the task properties and deselect the box “Display output when this task is run”
4. PowerShell Script
The PowerShell script I used in this example can be downloaded here
The section which is responsible for the input is here so if you have existing scripts this is what you are looking for to make them interactive:
#Get the server to connect to
[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.VisualBasic’) | Out-Null
$server = [Microsoft.VisualBasic.Interaction]::InputBox("Enter a Servername", "Servername", "")
System Center 2012–Extended OIP–Maintenance Mode POWER!! – Self Service portal
This posting is about using the Self Service Portal to set OpsMgr objects in maintenance mode. This simple example shows how you can use the System Center 2012 Extended OIP in combination with SCSM and OpsMgr.
<<<<<———>>>>> Download Latest version <<<<<———->>>>>
The runbook can be used to make adhoc maintenance mode available to application owners.
The Runbook
The first thing which you need to configure is a runbook in Orchestrator.
Start a new runbook and name the runbook AdHoc Maintenance.
The end result should look like the figure below:
First you will need to add the Initialize data activity with the following settings:
The runbook activity template
After creating the runbook you can sync the orchestrator connector to make the runbook available in SCSM. After making sure the runbook is in SCSM you need to set create a runbook activity template
Service Request Template
Next you will need to create the Service Request Template to include the Runbook Activity.
Create Request Offering
After creating the service request template you can now create the request offering.
After setting these settings you can publish the request offering.
Service Offering
The last step is to create a service offering and add the request offering to the service request and publish the content on the se;f service portal.
THE END RESULT
After following the steps the end result should look similar to the pictures below:
| The request offering on the SSP. |
| Service Request |
| OpsMgr |
Wrap up
Here is one simple example on how to really benefit from the System Center 2012 Extended OIP and make Maintenance Mode available to Application owners since they are the people responsible for the application or services! Real easy to set maintenance mode and log everything directly in SCSM user who raised maintenance mode and when everything nicely logged at the place where it should be logged!
You can setup scoping on the Self Service portal this way to make these kind of tasks only available to a delegated group of users. You can add other activities as well to deliver full self service and the best part about it everything is logged in SCSM and no extra privileges required on the systems everything being taken care of by Orchestrator!
You can add scheduled runbooks in orchestrator itself for the scheduled maintenance tasks this extra SCSM request offering is just for when they want to place objects in maintenance NOW! ![]()
As a side note my main goal was to sync all groups from SCOM to SCSM which worked like a charm with the sync properties in the OIP!
BUT there is one really nasty thing when setting up the user prompts to query based. I had no way to filter the query on groups!!!! Which made this kind of useless and needed me to step away to a simple list.
Although I am assuming this is restricted because the UI for Query based is filtered and doesn’t make it possible to filter based on groups I will try if XML only works.
Because the end result when you select a group which lives in SCSM makes the solution more dynamic and less error sensitive you could add the group as affected item to the service request.
Next up
Will try a Exchange or Sharepoint Calendar solution where application owners can add schedules by using the Self Service Portal and using an orchestrator runbook to pull the schedule and set maintenance mode automated. This will really deliver scheduling and setting maintenance mode to the application owners / administrator leaving the OpsMgr admin to do nice things instead of scheduling maintenance for everything.
Cheers,
Oskar Landman
System Center 2012–Extended OIP–Maintenance Mode POWER!!
Ever since the beginning of OpsMgr scheduling maintenance mode always have been a pain and full of frustration! During time there are some PowerShell solutions and community tools based on scheduled tasks although they work they are not just that clever.
Finally the frustration is over and now the System Center 2012 Extended OIP includes the full maintenance mode POWER for activities for setting objects, groups of objects in maintenance mode with just a simple runbook!
Include a Initialize Data activity in your runbook, sync the runbook to SCSM and now Maintenance Mode can be leveraged from the Self Service Portal!
(Full solution included in next post!)
Be aware with great POWER comes great RESPONSIBILITY!
Never ever put your Management Servers in Maintenance mode!! First there is no reason to and second all Management servers in Maintenance mode leaves no one to take them out anymore!
Like shutting the door with the ONLY keys still inside!
Background
Since the release of Orchestrator my expectations where high! Especially concerning maintenance mode since Orchestrator is the way to go for scheduling your maintenance mode !!!
To my frustration there are activities but they are based on a per monitor perspective which works fine but this is to detailed! People want to put groups of objects in maintenance mode to easy schedule maintenance windows across the Datacenter or do a selection and place objects in maintenance mode with the option to only select this object or the underlying objects as well!
PowerShell should work but again I want to be able to fully use everything to it’s fullest ![]()
Therefore I created some extra activities based on C# to finally come up with a really diverse solution.
Activities
After previous activities here are the new extra activities for the Extended OIP to fully use Maintenance mode to it’s fullest POWER!!!!
- Class – Get Class Instances – Takes a class (Internal Name) and retrieves all class instances. Can be filtered by using the filtering options in the activity.
- Parameters:
-
The Internal Name of the Class. Internal name of the class
Class – Get GroupClass Instances – Takes a group (Internal Name) and retrieves all members of the group.
- Parameters:
-
The Internal Name of the group. Internal name of the group
SCOM MaintenanceMode – Start Group – Takes a group (Internal Name) and retrieves all members of the group and place them in maintenance mode.
Parameters:
| The Internal Name of the Group. | Internal name of the group |
| Maintenance Mode duration in minutes | Duration in minutes |
| Maintenance Mode Comment | Comment for the maintenance mode |
| Reason | Reason |
| Level | OneLevel – The object self Recursive – The object and all contained objects |
SCOM MaintenanceMode – Stop Group – Takes a group (Internal Name) and retrieves all members of the group and turn maintenance mode off.
Parameters:
| The Internal Name of the Group. | Internal name of the group |
| Level | OneLevel – The object self Recursive – The object and all contained objects |
SCOM MaintenanceMode – Start Object – Takes an object and places the object in maintenance mode.
| The Internal Name of the object. | Internal name of the object |
| Maintenance Mode duration in minutes | Duration in minutes |
| Maintenance Mode Comment | Comment for the maintenance mode |
| Reason | Reason |
| Level | OneLevel – The object self Recursive – The object and all contained objects |
SCOM MaintenanceMode – Stop Object – Takes an object and turns maintenance mode off.
| The Internal Name of the object. | Internal name of the object |
| Level | OneLevel – The object self Recursive – The object and all contained objects |
Wrap Up
This is version 2 of the System Center 2012 Extended OIP which now has a total of 12 Activities. With the maintenance mode activities you can basically automate all maintenance mode requirements from SCOM.
I have tested to upgrade the existing pack, but unfortunately there where some problems. Removing the old version and registering the new version worked.
<<<<<———>>>>> Download Latest version <<<<<———->>>>>
Next post tomorrow:
Maintenance mode where it should be : SCSM Self Service Portal! Use SSP to leverage Maintenance mode to the “common user” Application owners etc….
Upcoming week(s).
Exchange – Maintenance Mode Integration. Schedule your maintenance windows in a calendar and use Orchestrator to do the rest!
Challenges:
Create SCSM Approve Activity – after syncing packs an approval is now manually required. (SCSM Console SCOM CI Connector) This NEEDS to be automated.
More detailed explanation on how to build the integration packs
System Center 2012–Extended Integration Pack Synchronize management packs
This post will describe the how and why I created a extended System Center 2012 Integration pack. This will be a series of blogs explaining exactly how you can create your own integration packs and activities.
If you like authoring and want to know more on exactly how can you build an OIP please watch closely for the upcoming series. I will completely start with describing the process of using Visual Studio, C# and he System Center 2012 SDK to create a multi functional Integration pack.
<<<<<———>>>>> Download Latest version <<<<<———->>>>>
SYNC MPS across your environment!
If you just want to have the benefits of the Integration pack it is here for you to take advantage and use it.
I have though one small request to the people using this Integration pack:
Please send me your feedback on how it works.
If you feel you are missing activities in any on the System Center Suite products please let me know and I will work on adding those into this pack.
A little back ground
As you might know I have been playing with OpsMgr since MOM 2005 and started with Service Manager 2010 in the pre-Beta releases. The thing which fascinated me ever since SCSM 2010 come in the picture is the design of both products. I have posted a series on System Center Central to explain why I got really excited about both products. They are similar
Yes although we have no agents living in SCSM the base is the same. And that’s where the fun starts. Al the knowledge valid on OpsMgr you can re-use on SCSM. Cool isn’t it ![]()
And now with the whole System Center line being one Suite there are no boundaries to do whatever you want! Woohoo!
I had Orchestrator on my wish list for a long time but didn’t have time to dive into it. But finally I had some time and a request from a customer to find a way to automate stuff! ![]()
The first look at Orchestrator / Opalis I noticed something which I found a little strange.
Why they divided the integration packs of System Center?
If there was a time to show the integration and the suite altogether this was the time. Orchestrator the never ending workflow beneath System Center! It would have been more logical to build a System Center integration pack for the whole suite.
I haven’t seen a customer lately who uses one of the products and Orchestrator. Simply because it is a suite and orchestrator being the orchestrator behind the fully automated self service portals and automatic deployments.
The reason for this will probably lie in the fact the different integration packs are easier to manage around the products then one integration pack. This being said let’s take a look at the reason for building this pack and starting a new adventure.
The Reason
The reason for the integration pack is the lack of a nice way to synchronize management packs across the different systems. The most obvious one being SCOM –>SCSM I simply couldn’t live with the fact a customer will have to manually import packs in SCSM. And more important when they updated a pack in SCOM they again needed to follow the exact same procedure.
Let’s explain this some more.
From the beginning of OpsMgr we have been writing packs with custom classes and monitors to monitor the business critical applications and put them in Distributed applications. Now we have the option to install a SCOM CI Connector to synchronize these into SCSM. There are some steps to be taken but these are not really hard and only need to be done once.
The problem lies in the fact you need to import the SCOM packs which hold the classes into SCSM. If this is one pack, well still not really nice but we can live with this. What if you have like a 100 packs in OpsMgr all custom?
Not only this but OpsMgr authors keep on building, changing and updating these packs so you need to have some kind of way to automate the Management Pack Sync. Well the solution to this is within reach!
The hard way or the scripted way?
First I started to play around with Opalis and PowerShell. With not to much effort I managed to find a “dirty” way to sync packs. basically a couple of PowerShell scripts pulling data and putting it in Orchestrator. Despite this “worked” I had some serious doubts on this solution and well although PowerShell is great I wanted a more universal solution.
Well then there was the other end of the solution which was writing code myself……
Sometimes I think I really like pain and frustration, working long nights and endlessly testing and the occasionally bang my head against the wall. (Would have put in pull my hair but unfortunately this is already to late….probably lost those starting writing management packs and learning XML
with no experience what so ever…..)
But since I am an optimistic guy and really like a challenge…why not start with reading C# and eventually writing it as well. That’s one part after an hour you can write something saying hello to the world! never understood why you want to say hello to the world though..???? When you are the only person watching your screen, so snap out of it you are not saying HELLO to the world!
And after a while you can do smarter things but man I don’t have months to learn this stuff. And after months saying Hello world in 50 different ways wouldn’t deliver me an integration pack on C#. A little Site note here :
With the power of Orchestrator you can Actually say Hello to the world!
You can attach it to twitter and because of orchestrator you are finally able to actually say HELLO to the world….finally after years and years teaching people to say hello to the world and the only one they where saying hello to where themselves…..![]()
I needed to go a smarter way to bring me up to speed with C# the rest of this story you can read in the upcoming series!
So I decided to go once again the hard way! And to be honest the feeling you get once you manage to get the results you want are worth every minute of pain and frustration ! Hell Yeah!
The results
As explained I went the hard way and managed to write the integration pack and because of this I don’t see limitations in things you can achieve by this. So challenge me ![]()
The end result is because we have a nearly similar SDK for both SCSM as well as SCOM I have written a couple of activitiies which are the same code and can both run on both systems. Yes talking about efficiency !
Activities in the pack:
Export ManagementPack – Activity with possible filters to export any management pack from both SCOM as well as SCSM into a directory.
Get Class – Activity to get a class with possible filters on every property to het classes from both SCOM and SCSM.
Get Rule – Activity to get a rule with possible filters on every property to het classes from both SCOM and SCSM.
Import ManagementPack – takes a directory and imports any managementpack from the directory into the management group works on SCOM and SCSM.
List Managementpack – activity to get a management pack with possible filters on every property to get management packs from both SCOM and SCSM.
Seal Managementpack – Takes a directory with unsealed XML;s, a keyfile and company name and seals every management pack and sends the exported management packs to a separate directory.
Now with these activities you can synchronize management packs across your environment. Imagine you have a Test, acceptance, production setup or something similar and you can now with ease sync your management packs sealed or not across! Or you can backup your MP’s with one runbook from all environments!
SCSM –>SCSM
SCOM –>SCSM
SCOM –>SCOM
Al you need is to create a run book and one important thing!
Seal your custom management packs with 1 key otherwise you are not able to seal the management packs! or need to create a different runbook for every MP which is not really automation ![]()
Remember SCSM needs to have sealed management packs to enable data warehouse synchronization unsealed classes never get in the data warehouse. That’s why you need to seal!
Next I will show hot to setup a little runbook which does al this!
Runbook to Sync Management Packs
First You nee to setup the connections to SCOM and SCSM:
The end result your runbook should look something similar to below:
You can now schedule the runbook to run a sync on a regular basis! Or create backup runbooks or ……wel tons of other possibilities. Please share them and we can manage a real extended Integration pack for really going the extra miles with orchestrator!
Improvements
Although this works like a charm there is still a Manual step required within SCSM.
You need to Approve the packs for the SCOM CI Connector after running the runbook. ![]()
Another problem could be you are missing dependent management packs in SCSM for the import to fail.
So this isn’t perfect yet but next release will include more cleverness! ![]()
Wrap Up
Thing still missing are:
a dependent management pack check.
The next big challenge is to create a activity to approve the packs, this is a pretty complicated task but it should be possible but will take more and serious testing before I can release this activity.
After these I will be working on maintenance mode with the possibility to put groups of objects in maintenance including some clever mechanism to really schedule this in an exchange calendar.
There are probably tons of other runbooks to create with these activities so therefore here you have version 1.
During the series I will include these as well and explain the procedures around the activities and how to write and use them! Keep posted for the next version, I am planning to put the entire project on Codeplex once finished for everyone to learn and benefit from this.
Happy Authoring,
Oskar Landman
System Center 2012-Extended OIP “Scheduling OpsMgr Maintenance Mode in Exchange Calendar”
In my previous post I wrote about how to create an extended Integration pack for both OpsMgr and SCSM called System Center 2012-Extended OIP. I also showed you how to use the integration pack to deliver ad hoc maintenance mode from the SCSM Self Service Portal.
In this previous posting I promised to write a full blog how you could use an ordinary exchange calendar and schedule all your maintenance mode schedules in there. This blog will show you exactly this!
First of all sorry for the delay but blogging has been put a little to the background the last months since I was busy writing the authoring chapter for “System Center 2012 Operations Manager Unleashed”, fully called Chapter 22 “Authoring Management Packs and Reports”. ![]()
Never the less I think this post should definitely close the gap in OpsMgr 2012 around scheduling maintenance mode once and for all.
Some people asked why I didn’t make the start time available in the activity?
The answer to this is, if I recall correctly, there is no scheduling intelligence behind the start maintenance mode function. Although you can configure this by using the SDK it never knows when to start the maintenance since there is no schedule behind it watching when the start time occurs. Therefore the only option you have is start NOW.
Requirements
Before you can start with writing the runbook and implement the solution let’s sum up the integration packs used in this solution.
First of all here is a link for the official Microsoft Integration packs – Orchestrator Integration packs
And here the link to the wiki page containing both Microsoft and community packs – Wiki Orchestrator packs
The following integration packs are used:
Exchange Users Integration Pack for Orchestrator in System Center 2012 SP1
System Center 2012 Extended OIP Download Latest version
All testing has been done on a System Center 2012 SP1 and should also just work on System Center 2012.
The first part of the runbook – “Check a shared Calendar”
First of all you need to create a Service Account which is email enabled and therefore has a calendar.
For this example I have created a service account : SVC_Maintenance
After creating the account you can grant permissions to people who are allowed to schedule maintenance mode.
Now we are ready to create our runbook.
Wrap up of the first part
| Monitor Date/Time | Check for current Time every 5 minutes. |
| Format Date/Time | Get current time + 5 minutes to gather 2 points in time with a 5 minute interval in between. |
| Get Item | Connect to Exchange with the configured service account and gather all appointments between 2 points in time from the Calendar. |
Second part of the runbook – “Get group and set maintenance mode”
First a little warning (again) ![]()
Be aware with great POWER comes great RESPONSIBILITY!
Never ever put your Management Servers in Maintenance mode!! First there is no reason to and second all Management servers in Maintenance mode leaves no one to take them out anymore!
Like shutting the door with the ONLY keys still inside!
Better to be safe than sorry ![]()
In the second part of the runbook you are going to use the System Center 2012 extended OIP to set the maintenance mode according to the information in the shared calendar we retrieved earlier.
Basically the second part of the runbook is the same as we created earlier but to fully describe the solution let’s configure the entire runbook.
| Activity – Get Class | ||||||||||
|
||||||||||
| Activity – SCOM MaintenanceMode – Start Group | ||||||||||
|
Now that’s all there is to it ![]()
Just turn on the runbook and create an appointment!
Since we are using the location of the appointment to gather the displayname of the group we want to put into maintenance you need to make sure the location matches exactly the displayname of your group. Just copy/paste it from your OpsMgr console when creating the appointment and that’s it!
As soon as the workflow catches your appointment the workflow will query for the group based on the displayname and sends this information together with the duration of the maintenance mode to SCOM.
Wrap Up
With this 4 step runbook you are now able to deliver REAL scheduled maintenance mode to your customers.
You can grant the key users access to this calendar to schedule their own maintenance or open up the calendar with read only to all users so they can track exactly when a server goes into maintenance mode! ![]()
Now for the people who want more automation, you can now combine this solution with the ability to schedule changes from SCSM!!!!![]()
You can combine and extend this solution together with the solution Anders Bengtsson created.
With some orchestrator logic you should be able to easily retrieve the CI’s from the change and set them in maintenance mode exactly when the change will be deployed! Which combines SCSM – SCORCH – SCOM!
To be honest when you are using orchestrator in combination with the other System Center products you will soon discover the real power of System Center Magic!
Cheers,
Oskar Landman
Deploying your infra via Visio drawing and Orchestrator.
Hello,
The idea to automate or simplify the creation of an infrastructure with Orchestrator is reviewed and discussed during several chats with my college Bart Timmermans (aka Hyper-B). The idea was there to have simple entry to “draw” your infrastructure and after that everything is build via Orchestrator. We came to the following building blocks to enable the solution:
- - A Visio template is the start point of the automated solution. In this template we have some extended properties that are required for further build of the infra.
- - Orchestrator Activity to read out the Visio drawing and put the information on the Orchestrator databus.
- - Orchestrator Runbook to deploy the infrastructure. (Visio must be installed on the Orchestrator Action server.)
Final result of this solution is flexibility in the Runbook to setup a server infrastructure. You draw the needed servers with the specific properties and roles in the Visio drawing. Save it as a *.vsd file. Orchestrator picks-up the vsd file and deploys the infrastructure. An example of a simplified Runbook is provided below.
Information that is available on the “Read Visio” Activity for server OS deployment.
Take this a bit further….You create a Service Request via Service Manager self-service portal with approval defined in the process. Once the approval is provided to deploy, Orchestrator kicks-in…read the file and at the end you get notified that you infrastructure is ready to use….
This blog post will describe the procedure to create such an Orchestrator Activity and give you some information around the solution. It is important to understand how this is build. In this way you can fine-tune this solution to your needs. Fine-tuning the solution can be done on different levels:
- - In this example setup I have some Visio shape properties, maybe you need other for your deployment.
- - It is not limited to server deployment, let’s imagine that you draw your SharePoint environment in Visio and Orchestrator deploys the environment.
As you will see in the example, server roles can be specified in Visio drawing. The back-end Orchestrator Runbook and maybe your virtualization platform (SC VMM of course
) must be tuned to actually install the role. This solution creates the bridge between the Visio drawing and getting this information available for your Runbook.
The next procedure will help you to build your solution. This is done in different steps and further elaborated in this procedure:
- - First we need to define the Visio template
- - An Orchestrator Acitivity needs to be created to read out the Visio shapes properties and publish the information on the Orchestrator databus.
- - Creation of the Orchestrator integration pack.
The Visio Template:
The Visio template is the input for the automated deployment. This information (datasets in Visio) must be fixed because the Activity in Orchestrator is expecting a fixed set of information.
The following shape data is used in the example template:
Visio is giving us the flexibility to draw the infrastructure and define properties of the infrastructure.
(you can enhance this with a lot of other items. Once you have read-out the vsd file in your code then you will see that you can even read the connection between the shapes….)
The Orchestrator Activity
The first part of this creation is the coding in Visual Studio.
Open Visual Studio, create new C# Class and add following references in the project:
-
- Microsoft.Office.Interop.Visio ( C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Visio )
-
- Microsoft.SystemCenter.Orchestrator.Integration (Microsoft System Center 2012\Orchestrator\Integration Toolkit\Bin)
Once the references are made update your class, rename the class to something meaningful and add the new reference in your class. Starting point is looking like this:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Office.Interop.Visio; using Microsoft.SystemCenter.Orchestrator.Integration; namespace VisioReadDrawing { public class VisioReadDrawing { } }
In this class defined the “design” and “execute” for your Activity. Your Activity name is specified ("Read Visio") and the framework for you Orchestrator Activity is set. More information on this base implementation can be found in the Orchestrator SDK (Taking an Imperative Approach)
[Activity ("Read Visio for OS deployment")] public class ReadVisioActivity : IActivity { public void Design(IActivityDesigner designer) { } public void Execute(IActivityRequest filelocation, IActivityResponse ShapeProperty) { } }
Define the Runbook Designer for your Activity.
In order to have some interaction in the Activity we need to have inputs and outputs. The inputs for our Runbook is the file location. For output we must follow the extended data information that we have defined in our Visio template. Our Design part of the Activity should look like this if we follow the properties defined in the Visio template:
public void Design(IActivityDesigner designer) { if (designer == null) { throw new ArgumentNullException("designer"); } designer.AddInput("Visio File location"); designer.AddOutput("ComputerName"); designer.AddOutput("Role"); designer.AddOutput("Virtual"); designer.AddOutput("Operating System"); designer.AddOutput("Memory"); designer.AddOutput("CPU"); designer.AddOutput("IP Address"); }
Define the Runbook Execution for your Activity
In this part of the solution we need to get the needed information and publish the result for further use in the Runbook.
- - First we have some checks to make sure we have the needed input/output.
- - ReadProp() is a class that I have added to hold all my functions required in the Activity. (habit of me to split this up in different classes.) In this class I have created the “GetAllShapesInVisio” function that reads out the Visio drawing (See next box of code)
- - The info we get back from the function is in a format of List<Dictionary<string,string>. The Dictionary part of the output holds the properties of the Shape. List of Dictionary is a list of properties for all shapes. In this way we get all information in the Runbook.
public void Execute(IActivityRequest filelocation, IActivityResponse ShapeProperty)
{
if (filelocation == null)
{
throw new ArgumentNullException("filelocation");
}if (ShapeProperty == null)
{
throw new ArgumentNullException("ShapeProperty");
}
// Open up one of Visio's sample drawings.
string hwinput = filelocation.Inputs[PublishedData.FileLocation].AsString();
if(string.IsNullOrEmpty(hwinput))
{
return;}
var InfoReadVisio = new ReadProp();
var InfoGetShapes = InfoReadVisio.GetAllShapesInVisio(hwinput);foreach (var shape in InfoGetShapes)
{
ShapeProperty.Publish(shape);
}
}
The GetAllShapesInVisio function
public Page page; public List<Dictionary<string, string>> GetAllShapesInVisio(string hwinput) { Application app = new Application(); app.Visible = false; List<Dictionary<string, string>> AllShapes = new List<Dictionary<string, string>>(); Document doc = app.Documents.OpenEx(@hwinput, (short)VisOpenSaveArgs.visOpenRO + (short)VisOpenSaveArgs.visOpenMinimized); // Get the first page in the sample drawing. page = doc.Pages[1]; foreach (Shape shape in page.Shapes) { Dictionary<string, string> AllProperty = new Dictionary<string, string>(); short iRow = (short)VisRowIndices.visRowFirst; // While there are stil rows to look at. while (shape.get_CellsSRCExists((short)VisSectionIndices.visSectionProp, iRow, (short)VisCellIndices.visCustPropsValue, (short)0) != 0) { // Get the label and value of the current property. string label = shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, iRow, (short)VisCellIndices.visCustPropsLabel).get_ResultStr(VisUnitCodes.visNoCast); string value = shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, iRow, (short)VisCellIndices.visCustPropsValue).get_ResultStr(VisUnitCodes.visNoCast); AllProperty.Add(label, value); // Move to the next row in the properties section. iRow++; } AllShapes.Add(AllProperty); } app.ActiveDocument.Saved = false; app.AlertResponse = 7; app.ActiveDocument.Close(); app.Quit(); return AllShapes; }
All done in Visual Studio, build your solution and the .dll is ready for integration in Orchestrator via the Orchestrator Toolkit.
Don’t forget you can always test your code with the Invoke .NET activity from the Integration Toolkit.
Create the Integration Pack for Orchestrator
Start the Orchestrator Integration Pack Wizard, click Next on the Welcome screen.
On the Product Details, specify the needed information. You can add a specific Icon for the Activity. More information how to do this can be found on Bart’s blog or on Technet.
Click Next.
On the Activity page of the wizard, click Add and Browse to the .dll file we just have created. Select your Activity from the dropdown. Add a description or a specific Activity icon if needed and click Ok.
Click Next to proceed in the wizard.
On the Dependencies and Included files page, click Next. Not needed in this case.
On the Orchestrator Integration Pack File page, select the path and file name. Click Next to build and finalize the Integration Pack.
Click Finish and all done, you can integrate the Activity now in via the Deployment Manager and use it in your Runbook to deploy servers…
Think about the different automations you can build with this. I have seen in a lot of cases that the input for server deployment is a Visio file. Instead of typing the information in the different wizards to deploy the server you can start with the template and let it “travel” through the approval request…once approved, the servers get build via the same drawing.
This is one example, Your code behind gets the information and defines what information you put on the Orchestrator databus.
I hope this is clear enough to get you started with building something similar. Feel free to put comments on the blog so we can optimize the procedure.
Have fun!!
Kurt Van Hoecke
SCOM Speak PowerShell script
In my early days of monitoring we had a dedicated computer set up who read out all the critical alerts as for example a server was down. It was a fairly simple setup but had it’s flaws and it was not combined with System Center Operations Manager (which is already a big flaw).
The idea to create a PowerShell script for just doing that was already a significant time on my to do list but kind of made it to the top of my list due to a Facebook request I got last week.
Prerequisites
SCOM 2007 (will post the SCOM 2012 version shortly)
The pc you want to read out the alert on needs to have:
WinRM needs to be enabled
At least .net framework 3.0 needs to be installed
PowerShell 2.0 needs to be installed
Speakers (pretty obvious no?)
Setup of the PC
First of all make sure that Computer has PowerShell 2.0 installed.
If this is not the case download and install it here: http://support.microsoft.com/kb/968930
Open PowerShell by browsing to Start > Accessories > Windows Powershell and open Powershell as administrator by right clicking and choosing run as admin:
Next thing on our list is to enable the ability remotely execute commands on the computer.
Run: “Enable-PSRemoting –Force” to enable the WinRM service on the computer. ![]()
Verify afterwards that the service was started:
Now test from the RMS that the server is reachable through WinRM by running the following command on the RMS:
Test-WsMan COMPUTER (replace COMPUTER with the name of the computer you want the alert to be played on)
The following should appear:
The PowerShell Script:
In this example I’m using this script to read out a warning when there’s a server down but you can easily change it to your specific needs of course.
The script can be downloaded here
Copy paste of the script for your reference
#=========================================================================
# AUTHOR: Dieter Wijckmans
# DATE: 07/08/2012
# Name: speak_scom2007.PS1
# Version: 1.0
# COMMENT: Let SCOM read an alert out loud on a remote computer to notify the operator
# CREDITS:
# Usage: .\speak_scom2007.ps1 -$severity -$text -$pc1 -$machine
#
#=========================================================================
###Prepare environment for run###
####
# Start Ops Mgr snapin, get RMS
###
###
#Get parameters from command line, Start Ops Mgr snapin
###
param ([string]$severity,[string]$stext,[string]$pc1,[string]$machine)
#param ([string]$text,[string]$pc1)
##Read out the RMS name
$objCompSys = Get-WmiObject win32_computersystem
$rootMS = $objCompSys.name
#If the RMS is installed on a cluster comment the above 2 lines, uncomment the line below and fill in the server below.
#$rootMS = "Your clustered RMS here"
#Initializing the Ops Mgr 2007 Powershell provider#
Add-PSSnapin "Microsoft.EnterpriseManagement.OperationsManager.Client" -ErrorVariable errSnapin ;
Set-Location "OperationsManagerMonitoring::" -ErrorVariable errSnapin ;
new-managementGroupConnection -ConnectionString:$rootMS -ErrorVariable errSnapin ;
Set-Location $rootMS -ErrorVariable e-severrrSnapin ;
#Set Culture Info# In this case Dutch Belgium
$cultureInfo = [System.Globalization.CultureInfo]‘nl-BE’
#Error handling setup
$error.clear()
$erroractionpreference = "SilentlyContinue"
$thisScript = $myInvocation.MyCommand.Path
$scriptRoot = Split-Path(Resolve-Path $thisScript)
$errorLogFile = Join-Path $scriptRoot "error.log"
if (Test-Path $errorLogFile) {Remove-Item $errorLogFile -Force}
#create the text to read. You can change this section to read out a different phrase
#Notice the extra spaces in the string. These are used to slow down the reading and make it more comprehensive
$text = $severity + " Alert on " + $machine + " " + $stext
#execute script#
invoke-command -computer $pc1 -scriptblock {[Reflection.Assembly]::LoadWithPartialName("System.Speech")
$voice = New-Object System.Speech.Synthesis.SpeechSynthesizer
$voice.Speak($args[0]) } -argumentlist $text
###
#Remove the Ops Mgr PSSnapin#
###
Remove-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
Note
You can change the actual change the sentence SCOM is speaking out loud in the highlighted section so let your imagination + creativity go wild on this…
Setup the notification channel
The last thing you have to do to let the computer read out the SCOM alerts is to make a subscription for the alert and pass the desired parameters.
For a full list of all the available parameters I would like to reference to a great post of Kevin Holman: http://blogs.technet.com/b/kevinholman/archive/2007/12/12/adding-custom-information-to-alert-descriptions-and-notifications.aspx
In my particular example I’m using the following parameters: Severity, Machine name, pc1 and text.
Severity: Alert severity
Machine name: machine which is down
Text: Free text you would like to read out loud.
Pc1: The machine where the text needs to be spoken.
Note
: You can send the command to multiple PC’s at the same time by adding a new variable to the command line and C/P the speak section in the script with the name of the new parameter.
The Notification Channel should look like this:
Full Path of the command file: C:\Windows\System32\WindowsPowerShell\V1.0\Powershell.exe
Command Line Parameters:
C:\Scripts\speak_scom2007.ps1 -severity ‘$Data/Context/DataItem/Severity$’ -stext ‘Machine Down’ -pc1 ‘desktop1′ -machine ‘$Data/Context/DataItem/ManagedEntityDisplayName$’
Startup folder for the command line:
C:\scripts
Only thing left to do is link this channel to a subscriber and make an actual subscription for the machine down alerts.
Now just wait until SCOM will start talking to you ![]()





