Archive for December, 2010

In a perfect world this never happens. BUT as we pretty often experience packages doesn’t reach its destination distribution point and gets stuck on the Pending status, and triggering a refresh on the distribution point doesn’t help. Of course we could just update the Distribution Points for the package, but that would affect all distribution points and in large environments that isn’t good enough. Below is a T-Sql script that I’m using to resolve this scenario by resetting the package on the distribution point in SQL and then do a refresh of the DP.

DISCLAIMER: This solution is brought AS IS with no warranties, and remember editing the ConfigMgr database is NOT supported by Microsoft.

1. Paste the SQL query below into a SQL Management Studio query window

USE SMS_%SITECODE%
Update pkgstatus set [Status] = 2 where id = '%PACKAGEID%' and sitecode = '%TARGETSITECODE%' and type = 1
Update pkgstatus set SourceVersion = 0 where id = '%PACKAGEID%' and sitecode = '%TARGETSITECODE%' and type = 1

2. Replace the variables %SITECODE%, %PACKAGEID% and %TARGETSITECODE% with your primary sitecode, packageid for your pending package and finally the sitecode for you target distribution point

3. Execute query

4. Refresh the package on the target distribution

5. Finished

Comments (0)
Dec
19

Color Coded Views

Posted by: | Comments (24)

The question has been asked a number of times: “Can the views in Service Manager be color coded?". For a while now I’ve been telling people that they can be. In this blog post I’ll show one way of doing exactly that.

Before I go into the details of how to do this I would like to take the opportunity to introduce Gridpro AB. Gridpro is the name of a new System Center (SC) focused company founded by me and my friend and co-founder Jonas Ullman. We’ll be focusing on developing products and solutions around the SC family of products. The company web site (http://www.gridpro.se) should be up within a few weeks but this blog will live on as my, Jonas and Gridpro’s contribution to the SC community. Now to the solution!

First, let’s take a look at what we want to accomplish. Using the Incident settings in Service Manager it’s possible to configure a priority matrix which is used by built in workflows to calculate the priority of an incident given the values of impact and urgency. Based on the calculated priority value I want to color code the incident in incident views in the Service Manager console according to the following table:

Priority Color
1 Red
2 Red
3 Red
4 Yellow
5 Yellow
6 Yellow
7 Green
8 Green
9 Green

The first thing to understand, which is what makes this possible, is that the column configuration of a view is XAML based code that is stored in a management pack. If you create a incident view containing the Priority property you’ll find the following line of XAML in the <Presentation> tag of the view definition within the management pack where you stored the view:

<mux:column name="Priority" displaymemberbinding="{Binding Path=Priority}"
 width="100" displayname="Priority.6bd567905b574b128823749bc7dc6e74"
 property="Priority" datatype="s:Int32" />

The code above defines the column that displays the priority value of each incident listed in the view. Now, after reading some documentation around the Service Manager Grid Views found here: Grid View Configuration and what it means. I found that the schema for the grid view column supports templates. This means that we can define how each cell in the column should be presented using any WPF control like Borders, Grids, Textboxes etc.

In the example below I’ve created a new view for incidents containing, amongst other properties, the incident priority. I’ve exported the management pack where I stored the view and added a new column definition using the cell template part of the schema. After a few minutes of serious designing Smile I came up with the following definition.

<mux:column datatype="s:Int32" property="Priority" displayname="Priority.6bd567905b574b128823749bc7dc6e74" width="110" name="PriorityColor">  
	<mux:column.celltemplate> 
		<datatemplate>  
			<border width="80" height="Auto" verticalalignment="Stretch" horizontalalignment="Stretch" background="{Binding Path=Priority, Converter={x:Static gridpro:PrioColorConverter.Default}}" cornerradius="5" borderbrush="Black" borderthickness="2"> 
				<dockpanel lastchildfill="True"> 
					<textblock verticalalignment="Center" horizontalalignment="Center" margin="0" text="{Binding Path=Priority}" /> 
				</dockpanel> 
			</border> 
		</datatemplate> 
	</mux:column.celltemplate> 
</mux:column>

I’ve basically copied the generated definition of the Priority column, given the column a new name, removed the DisplayMemberPath property and added the child elements that defines my new cell template. Also, notice that I’ve reused the generated DisplayName of the Priority column. Reusing the identifier of the Priority column DisplayName means that the column will get the header value “Priority”.

The most important part, which make the magic happen, is the binding defined of the Background property of the Border. Notice that I’m using a value converter. The value converter is a few lines of code that I’ve written in C# which takes a property value as input, applies my custom logics and returns a new value. Since the Background property expects a color I cannot simply bind the property to the incident priority, the border wouldn’t know which color to present for a value like “8”. Using the value converter which maps a priority value (1-9) and translates each of these values to value of either “green”, “yellow” or “red” the border can be displayed with the “correct” background color.

In the download, found in last in this post I’ve included an example management pack containing the view from the picture below, the assembly containing the value converter and the source code for the value converter. To try the example out:

  1. Copy the assembly “Gridpro.ChristmasGifts.Converters.dll” (containing the value converter) to the Service Manager installation path, usually “C:\Program Files\Microsoft System Center\Service Manager 2010”.
  2. Import the management pack “Gridpro.ChristmasGifts.ColorCodedView.xml”
  3. Make sure you’ve configured the Priority calculation within Incident Settings (Administration – Settings – Incident Settings).
  4. Make sure you have some incidents in your env. and go to Work Items – Incident – Merry Christmas

The result can be seen in the picture below, enjoy!

ColorCodedView

Download solution files: Color Coded Views – Gridpro Christmas Gift

Note: To learn how you can modify the cell template you should read up on basic Windows Presentation Foundation.

Be sure to read the comments made in the provided management pack.
Merry Christmas!

Comments (24)