From CI to parent business service – beta version

When dealing with CIs in Service Manager, you often cannot see if this specific CI belongs to a business service. I created a very first version of a custom task (PowerShell Script) to quickly get that information from any CI you want. I did not use this solution in a production environment as it is brand new and also in the very first steps. So it will need some more development optimizing and testing. Also I’d like to get your feedback what you think or if you have some additional input. Here we go.

The custom tasks pops up whenever a configuration item is selected.


The task executes a PowerShell script that checks if the CI belongs to one of the existing business sevices and gives the following different outputs.



I will play with the solution and optimize it during the next days/weeks. If you have any input let me know. Happy to get your opinion.

Update: Here is the first version (beta) of the script:


#Check if object is selected, if not exit if($selectedobjectobjectdisplayname -eq $null) { clear-host Write-Host “No object has been selected!” exit }

#Import smlets module if needed if(!(Get-Module smlets)){Import-Module smlets -force}

$resulthash = @{}

#Get SCSM business services $bservices = get-scsmobject -class (get-scsmclass system.service$)

#Get components of SCSM business services foreach($bservice in $bservices) { $components = $null $componentsarray = @()

$components = $bservice | get-scsmrelatedobject -depth 1 foreach($component in $components) { $componentsarray += $ } $resulthash.add($bservice.displayname,$componentsarray) }

#Search object guid $businessservices = $resulthash.GetEnumerator() | Where-Object {$_.Value -like $selectedobjectobjectdisplayname} | foreach{$_.key}

#Output result clear-host if($businessservices -eq $null)     {     Write-Host “The selected object does not belong to a business service” } else{     Write-Host “The selected object belongs to the following business service(s):” $businessservices     }

#Remove smlets module Remove-Module smlets -force

Additional note:

After finishing my solution I found out that Christian Booth posted a similar solution that you can find here:
The approach is different and focussed on Change Requests. Make sure you check that solution as well.


About Marcel Zehner

Microsoft Azure MVP
This entry was posted in SCSM and tagged , , , . Bookmark the permalink.

10 Responses to From CI to parent business service – beta version

  1. Pingback: From CI to parent business service – beta version - SysManBlog

  2. Morten says:

    Hi Marcel,

    I am trying to achieve the same thing, but it seems to get very complicated when you are dealing with the Service Components of a Business Service. Because often you’ll want to integrate SCOM Distributed Applications, and then you can’t use the relationshipclass Microsoft.SystemCenter.ServiceDesigner.ServiceHasGroups, because the SCOM MP defines its own relationships.

    Does your script take this into account or where does the relationship relates to? Christian Booths script does not use Service Components either, but the Related Config Items of the Business Service. I think this is not how it’s supposed to be, but again, the right way seems pretty complex to achieve afaik.

    • Morten says:

      Just to clarify: I want to make a custom typeprojection that has a relationship to the business services child CI’s. So I can use it on the portal to show only the CI’s from a previous selected business service.

      Doing this via a script seems to be easier as you can do a recursive thing: Get-SCSMRelatedObject -SMObject $businessService -Depth Recursive

      But making a type projection seems impossible as their could be 100 of different relationships when dealing with a distributed application. Or maybe I’m seeing it wrongly?

      • Marcel Zehner says:

        Hey Morten

        Because of your concern I decided to go for a “top-down” approach and used the -depth switch to get all child objects of my business services – this way I dont have to care about the different relationships. Something like that:

        $components = $bservice | get-scsmrelatedobject -depth 1

        I then write the result of all child objects together with the business service name to a hashtable. After that I search the object of interest (for instance a web site) in this hash table. That works. The only thing I don’t know if what that means (from a performance perspective) for environments with lots (100+) business services.


      • Marcel Zehner says:


        I added the beta script to the post …


  3. Morten says:

    Quick answer 🙂

    I think your script is the right approach to use components as the related CI’s. This way you can use the service map of Distributed Applications as well. Your script could fail if you have duplicate business services (with same displayname) as a hashtable key needs to be Unique. But then again.. who has that? 🙂

    If only I had free hands to use a scriptlet on the portal, my problem is that there doesn’t seem to be a consistent relationship class that binds business services and their components, not if you’re making a distributed application from SCOM at least.

  4. Pingback: Add Business Service to Change Request in Service Manager based on related Windows Computers |

  5. Joe says:

    Hey Marcel. Thanks for the beta script. I don’t suppose you have continued work on this and have an updated version? Thanks, Joe

  6. Hello Marcel. Looks like this could be a great script. Is this the latest version or do you have a newer version you are willing to share? Thanks, Joe

    • Marcel Zehner says:

      Hey Joe

      For now this is the latest version … not very efficient, but it works. I never invested time to optimize this so far.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s