Home Service Manager
Options

Review Activity / Line Manager Issues

Adam_LloydAdam_Lloyd Customer IT Monkey ✭

Hope i've put this in the right place, not really a Cireson issue more of a SCSM / Ad Connector issue.

Backstory: Some of our staff log tickets that have line manager review activities attached to the template, we notice that some line managers aren't getting populated in the review activity, but just for a subset of people.

Upon investigation, it seems that its users that have moved department or changed line manager, when I get relationship objects of class UserManagesUser the affected people have more than 1 related object, the old manager and the new manager. I would have thought this shouldn't be the case / cause issue but it does.

Anyway I wrote a quick script to fetch and remove the old line manager relationship object from the users which does solve the issue but was wondering if there's something we're doing wrong / can do to fix - any help appreciated, thanks!

Script to check individual user and then a section to cycle through all affected users and remove the oldest relationship object:

Import-Module SMLets
$smdefaultcomputer = "azrscsm19-01.v1.com"

##Checking for Singular Duplicate Manager of Employee::##
$usertocheck = "lloyda"
$User = Get-SCSMObject -Class (Get-SCSMClass -Name System.Domain.User) -filter "Username -eq '$($usertocheck)"
$UserManagesUser = Get-SCSMRelationshipClass -Name UserManagesUser
$Manager = (Get-SCSMRelationshipObject -ByTarget $User | ?{$_.RelationshipId -eq $UserManagesUser.Id}).SourceObject
$Manager
####

##Cycling through all relationships and finding users with more than one manager relationship assigned.. and nerfing the old ones...
$UserManagesUser = Get-SCSMRelationshipClass -Name UserManagesUser
$AllRels = Get-SCSMRelationshipObject -Relationship $UserManagesUser
$GroupedRels = $AllRels | Group-Object -Property TargetObject
$MoreThanOneManager = $GroupedRels | ?{$_.Count -gt 1}
foreach($group in $MoreThanOneManager){
    $sorted = $group.group | Sort-Object -Property LastModified -Descending
    for($i=1; $i -lt $sorted.count; $i++){
        Remove-SCSMRelationShipObject -SMObject $sorted[$i] -verbose
    }
}


Answers

  • Options
    Brett_MoffettBrett_Moffett Cireson PACE Super IT Monkey ✭✭✭✭✭

    Hi @Adam_Lloyd

    This is the perfect place for this question. Lots of SCSM peeps in here.

    I've not seen the line manager issue before but I have seen issues with users moving OUs. This might be happening here if you have ddepartment based OUs.

    I wrote a blog article a while back about renaming users within AD Managing Username Changes in Service Manager | System Center Noise (wordpress.com) this might help understand what SCSM is doing and how you might be able to address it.

    Whatever you find, please post it back here for others to learn from in the future.

    Thanks

Sign In or Register to comment.