Functions/HealthCheck/Workflows/Get-AMHCWorkflowEvaluationObjectNonResultLink.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
function Get-AMHCWorkflowEvaluationObjectNonResultLink {
    <#
        .SYNOPSIS
            Workflows with Non-Result Links for Evaluation Objects
 
        .DESCRIPTION
            Workflow evaluation objects that have any non-result links
 
        .PARAMETER Workflows
            The workflows to perform health check against
    #>

    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [AllowNull()]
        $Workflows
    )

    foreach ($workflow in $Workflows) {
        foreach ($item in ($workflow.Items | Where-Object {$_.ConstructType -eq "Evaluation"})) {
            $links = $workflow.Links | Where-Object {$_.SourceID -eq $item.ID}
            if ($links.LinkType -contains "Success" -or $links.LinkType -contains "Failure") {
                [AMConstructHealthCheckItem]::New($workflow, "Evaluation: $($item.Expression)")
            }
        }
    }
}