Explorer/ExecuteRulesetJob.ps1

param($command)

try {
    $WarningPreference = 'SilentlyContinue' 
    $VerbosePreference = 'SilentlyContinue'       

    if (-not (Get-Command TR -ErrorAction Ignore)) {
        function Global:TR {
            param([string]$Text)
        }
    }

    Initialize-SRxEnv -SourceID $command.ts_SourceID
    $global:SRxEnv.SetCustomProperty("SourceTag", $command.ts_SourceID)


    if ($global:SRxEnv.Exists) {
        Set-SRxCommand -command $command 
        if( $global:SRxEnv.SOP.ts_IsAdmin -and (-not $global:SRxEnv.isStakeHolder)) {
            $output = New-SRxReport -RuleSet "Invoke-NotImplemented"
        }
        else {
            Connect-SRxSPOService
            $output = New-SRxReport -RuleSet $global:SRxEnv.SOP.ts_RuleSet
        }  
    }
        
}
catch {
    Write-Host "ERROR - ExecuteRulesetJob 2 "
    Format-SRxErrorReport -err $_
    Write-Host ($_.Exception.Message)
    Write-Error -ErrorRecord $_
}