Recently we used the “Line Manager Should Review” Option in SCSM Review Activities the First Time with a Customer. We quickly ran into a problem that the Manager could not be gathered with this error.
“Cannot identify line manager of”
After some googling, we found that old TechNet Article that the affected USer might have 2 Managers in SCSM.
With the following lines, we quickly saw this was true
Import-Module SMLets
$User = Get-SCSMObject -Class (Get-SCSMClass -Name System.Domain.User) -filter "Username -eq '<username>'"
$UserManagesUser = Get-SCSMRelationshipClass -Name UserManagesUser
$Manager = (Get-SCSMRelationshipObject -ByTarget $User | ?{$_.RelationshipId -eq $UserManagesUser.Id}).SourceObject
$Manager
We found the information on this TechNet Article: Cannot identify line manager of (microsoft.com)
Unfortunately, the linked PowerShell Script is not available anymore, so I have done my own.
So, the whole script is available at GitHub: System-Center-Service-Manager/PowerShell Scripts/Remove old SCSM Managers at main · Seidlm/System-Center-Service-Manager (github.com)
Michael Seidl, aka Techguy
au2mate, everything