How to fix Cannot identify line manager of error RRS feed

  • Question

  • This is with System Center 2012 in the Service Manager console.  In a Change Request, Review Activity it is set to get the manager by having the "Line Manager Should Review" checkbox.  Sometimes when this task runs it stops with an error of "Cannot identify line manager of" and then the Created By user name after that.  This is caused by Service Manager having two records of a manager of the created by user. 

    I run this Powershell query to see that the user has two manager records:

    CD 'C:\Program Files\Microsoft System Center\Service Manager 2012\Powershell'
    Import-Module .\System.Center.Service.Manager.psd1
    new-SCmanagementgroupconnection -computername vmsmc01

    CD 'C:\scripts'

    $username = $ARGS[0];
    $usermanagerrel = Get-SCSMRelationship | where {$_.Name -eq "System.UserManagesUser"}
    $ADUserClass = get-scclass | ? {$_.DisplayName -eq "Active Directory User"}
    $user = Get-SCClassInstance -class $ADUserClass | ? {$_.DisplayName -eq $username}

    Get-SCSMRelationshipInstance -target $user | where {$_.RelationshipID -eq $usermanagerrel.id} | ft @{Expression={$_.TargetObject};Label="User"}, @{Expression={$_.SourceObject};Label="Manager"},ID

    The manager record is correct in AD.  Re-syncing the AD connector in service manager does not fix this.

    How do I fix the record for this user?


    Thursday, October 25, 2012 6:18 PM

All replies

  • Did you ever find a solution for this?

    I seem to be experiencing this problem myself,  I did try to confirm it using the Powershell query you supplied but at the last step i get this error:

    Get-SCRelationshipInstance : Cannot validate argument on parameter 'TargetInstance'. The argument is null. Supply a non
    -null argument and try the command again.
    At line:1 char:37
    + Get-SCSMRelationshipInstance -target <<<<  $user | where {$_.RelationshipID -eq $usermanagerrel.id} | ft @{Expression
    ={$_.TargetObject};Label="User"}, @{Expression={$_.SourceObject};Label="Manager"},ID
        + CategoryInfo          : InvalidData: (:) [Get-SCRelationshipInstance], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.SystemCenter.Core.Commands.GetSCRelationshipI

    However approvals based on a particular users line manager was working, then after their manager was changed in AD and the SM AD connector syncronised approvals based on that users line manager no longer work, instead the review activity reports "Cannot Identify line manager of <username>"

    I have checked both the AD User Object and the Service Manager User configuration item and they are both showing the same correct user as the manager. I have cleared the manager field in AD resynced then added the manager again in AD and resynced again and still the review activity "Cannot identify the line manager...".

    other users who have not had the manager changed seem to be working fine.

    Any assistance you or any one else seeingthis post can provide would be greatly appreciated.

    Wednesday, August 28, 2013 4:32 AM
  • Yes, I did get mine fixed.  For the error you're receiving when running that script, it may be due to it not finding the user name you are passing in.  I get that same error when I give it a bad user name.  I have my script named SMGetManagers.ps1.  I run the script as: .\SMGetManagers.ps1 "user name here"

    The user name needs to be the display name like how you would see it in the address book.

    To remove the multiple manager entries for the affected user, I believe I ran this script below.  But, it's been a long time since I had to deal with this problem so I'm not exactly sure of the steps I took now.  So, use at your own risk.  You'll need to put your management server name in the script then pass it the affected user.

    Then after this run your AD connector to sync in the current manager for the user.  Again, my memory on how I resolved this is fuzzy but I believe this is what I did.

    If you save this script as SMRemoveManagers.ps1 you would run it as .\SMRemoveManagers.ps1 "affected user here"

    CD 'C:\Program Files\Microsoft System Center\Service Manager 2012\Powershell'
    Import-Module .\System.Center.Service.Manager.psd1
    new-SCmanagementgroupconnection -computername yourmanagementserver

    CD 'C:\scripts'

    $username = $ARGS[0];
    $usermanagerrel = Get-SCSMRelationship | where {$_.Name -eq "System.UserManagesUser"}
    $ADUserClass = get-scclass | ? {$_.DisplayName -eq "Active Directory User"}
    $user = Get-SCClassInstance -class $ADUserClass | ? {$_.DisplayName -eq $username}

    Remove-SCSMRelationshipInstance -target $user | where {$_.RelationshipID -eq $usermanagerrel.id}

    Wednesday, August 28, 2013 4:22 PM