Public/Get-CAMRelatedCustodian.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Function Get-CAMRelatedCustodian
{
<#
    .SYNOPSIS
        Function to retrieve the Related Custodian of an object
     
    .DESCRIPTION
        Function to retrieve the Related Custodian of an object
     
    .PARAMETER WorkItemObject
        Specifies the Object to process
     
    .EXAMPLE
        PS C:\> Get-CAMRelatedCustodian -WorkItemObject $SupportContract
     
    .NOTES
        Francois-Xavier Cat
        www.lazywinadmin.com
        @lazywinadm
        github.com/lazywinadmin
#>

    [CmdletBinding()]
    param (
        [Parameter(ValueFromPipeline)]
        $WorkItemObject
    )
    # Custodian RelationShip
    $OwnedByUser_relclass_id = 'cbb45424-b0a2-72f0-d535-541941cdf8e1'
    $OwnedByUser_relclass_obj = Get-SCSMRelationshipClass -id $OwnedByUser_relclass_id
    Get-SCSMRelatedObject -SMObject $WorkItemObject -Relationship $OwnedByUser_relclass_obj
}