lib/core/jea/Test-IcingaJEAServiceRunning.psm1

function Test-IcingaJEAServiceRunning()
{
    param (
        [string]$JeaPid = $null
    );

    if ([string]::IsNullOrEmpty($JeaPid)) {
        [string]$JeaPid = Get-IcingaJEAServicePid;
    }

    if ([string]::IsNullOrEmpty($JeaPid)) {
        return $FALSE;
    }

    $JeaPowerShellProcess = Get-Process -Id $JeaPid -ErrorAction SilentlyContinue;
    if ($null -eq $JeaPowerShellProcess) {
        return $FALSE;
    }

    if ($JeaPowerShellProcess.ProcessName -ne 'wsmprovhost') {
        return $FALSE;
    }

    return $TRUE;
}