def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="") == "\\AgentExecutor.exe",
                    event.deep_get("OriginalFileName", default="") == "AgentExecutor.exe",
                ]
            ),
            any(
                [
                    " -powershell" in event.deep_get("CommandLine", default=""),
                    " -remediationScript" in event.deep_get("CommandLine", default=""),
                ]
            ),
            not event.deep_get("ParentImage", default="").endswith(
                "\\Microsoft.Management.Services.IntuneWindowsAgent.exe"
            ),
        ]
    ):
        return True
    return False
