def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\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 any(
                [
                    any(
                        [
                            "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\"
                            in event.deep_get("CommandLine", default=""),
                            "C:\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\"
                            in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    event.deep_get("ParentImage", default="").endswith(
                        "\\Microsoft.Management.Services.IntuneWindowsAgent.exe"
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
