def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\schtasks.exe"),
                    event.deep_get("OriginalFileName", default="") == "schtasks.exe",
                ]
            ),
            " /create " in event.deep_get("CommandLine", default=""),
            any(
                [
                    "powershell" in event.deep_get("CommandLine", default=""),
                    "pwsh" in event.deep_get("CommandLine", default=""),
                    "cmd /c " in event.deep_get("CommandLine", default=""),
                    "cmd /k " in event.deep_get("CommandLine", default=""),
                    "cmd /r " in event.deep_get("CommandLine", default=""),
                    "cmd.exe /c " in event.deep_get("CommandLine", default=""),
                    "cmd.exe /k " in event.deep_get("CommandLine", default=""),
                    "cmd.exe /r " in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    "C:\\ProgramData\\" in event.deep_get("CommandLine", default=""),
                    "%ProgramData%" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
