Explorer/ExecuteRulesetJob.ps1

param($command)

try {
# $writer = Get-SRxCustomizationWriter
# $writer.Start($command)

    #Write-Host "---------------------------------"
    #Write-Host "BEGIN - ExecuteRulesetJob "
    #Write-Host "---------------------------------"

    #Import-Module "Microsoft.PowerShell.Management" -DisableNameChecking -Verbose:$false -Force
    #Import-Module "Microsoft.PowerShell.Utility" -DisableNameChecking -Verbose:$false -Force
# Write-Host ($command | FL | Out-String)
    #Write-Host "command.ts_SourceID = $($command.ts_SourceID)"

    Initialize-SRxEnv -SourceID $command.ts_SourceID# -LoadModule2 $LoadModule
    #if ($global:SRxEnv.Exists) { Start-SRxShell -ControlFile $command.ts_ControlFile -isJob }
    #$global:SRxEnv.SourceTag = $($command.ts_SourceID)
    $global:SRxEnv.SetCustomProperty("SourceTag", $command.ts_SourceID)
    #Write-Host "SourceTag = $($global:SRxEnv.SourceTag)"


    if ($global:SRxEnv.Exists) {
        Set-SRxCommand -command $command 
        if( $global:SRxEnv.SOP.ts_IsAdmin -and (-not $global:SRxEnv.isStakeHolder)) {
            $output = New-SRxReport -ControlFile "Invoke-NotImplemented"
        }
        else {
            Connect-SRxSPOService #refresh it
            $output = New-SRxReport -ControlFile $global:SRxEnv.SOP.ts_ControlFile
        }  
    }
        
    #Write-Host "---------------------------------"
    #Write-Host "END - ExecuteRulesetJob "
    #Write-Host "---------------------------------"

}
catch {
    Write-Host ($_.Exception.Message)
}

#$object = [pscustomobject]$command
#$object