def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\schtasks.exe"),
                    event.deep_get("OriginalFileName", default="") == "schtasks.exe",
                ]
            ),
            any(
                [
                    " ONLOGON " in event.deep_get("CommandLine", default=""),
                    " ONSTART " in event.deep_get("CommandLine", default=""),
                    " ONCE " in event.deep_get("CommandLine", default=""),
                    " ONIDLE " in event.deep_get("CommandLine", default=""),
                ]
            ),
            not any(
                [
                    "NT AUT" in event.deep_get("CommandLine", default=""),
                    " SYSTEM" in event.deep_get("CommandLine", default=""),
                    "HIGHEST" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
