def rule(event):
    if all(
        [
            event.deep_get("ParentImage", default="").endswith("\\sdiagnhost.exe"),
            any(
                [
                    event.deep_get("Image", default="").endswith("\\powershell.exe"),
                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                    event.deep_get("Image", default="").endswith("\\cmd.exe"),
                    event.deep_get("Image", default="").endswith("\\mshta.exe"),
                    event.deep_get("Image", default="").endswith("\\cscript.exe"),
                    event.deep_get("Image", default="").endswith("\\wscript.exe"),
                    event.deep_get("Image", default="").endswith("\\taskkill.exe"),
                    event.deep_get("Image", default="").endswith("\\regsvr32.exe"),
                    event.deep_get("Image", default="").endswith("\\rundll32.exe"),
                    event.deep_get("Image", default="").endswith("\\calc.exe"),
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("Image", default="").endswith("\\cmd.exe"),
                            "bits" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            any(
                                [
                                    event.deep_get("CommandLine", default="").endswith(
                                        "-noprofile -"
                                    ),
                                    event.deep_get("CommandLine", default="").endswith(
                                        "-noprofile"
                                    ),
                                ]
                            ),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
