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:
param($selectedobjectobjectdisplayname)
#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 += $component.name } $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:
http://blogs.technet.com/b/servicemanager/archive/2013/09/18/scsm-console-extensions-impacted-business-services.aspx
The approach is different and focussed on Change Requests. Make sure you check that solution as well.
Cheers
Marcel
Pingback: From CI to parent business service – beta version - SysManBlog
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.
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?
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.
Cheers
Marcel
Hey
I added the beta script to the post …
Cheers
Marcel
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.
Pingback: Add Business Service to Change Request in Service Manager based on related Windows Computers | ITBlog.no
Hey Marcel. Thanks for the beta script. I don’t suppose you have continued work on this and have an updated version? Thanks, Joe
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
Hey Joe
For now this is the latest version … not very efficient, but it works. I never invested time to optimize this so far.
Cheers
Marcel