def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("ParentImage", default="").endswith("\\powershell_ise.exe"),
                    event.deep_get("ParentImage", default="").endswith("\\powershell.exe"),
                    event.deep_get("ParentImage", default="").endswith("\\pwsh.exe"),
                ]
            ),
            any(
                [
                    event.deep_get("Image", default="").endswith("\\bash.exe"),
                    event.deep_get("Image", default="").endswith("\\bitsadmin.exe"),
                    event.deep_get("Image", default="").endswith("\\certutil.exe"),
                    event.deep_get("Image", default="").endswith("\\cscript.exe"),
                    event.deep_get("Image", default="").endswith("\\forfiles.exe"),
                    event.deep_get("Image", default="").endswith("\\hh.exe"),
                    event.deep_get("Image", default="").endswith("\\mshta.exe"),
                    event.deep_get("Image", default="").endswith("\\regsvr32.exe"),
                    event.deep_get("Image", default="").endswith("\\rundll32.exe"),
                    event.deep_get("Image", default="").endswith("\\schtasks.exe"),
                    event.deep_get("Image", default="").endswith("\\scrcons.exe"),
                    event.deep_get("Image", default="").endswith("\\scriptrunner.exe"),
                    event.deep_get("Image", default="").endswith("\\sh.exe"),
                    event.deep_get("Image", default="").endswith("\\wmic.exe"),
                    event.deep_get("Image", default="").endswith("\\wscript.exe"),
                ]
            ),
            not any(
                [
                    all(
                        [
                            event.deep_get("Image", default="").endswith("\\certutil.exe"),
                            "-verifystore " in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").endswith("\\wmic.exe"),
                            any(
                                [
                                    "qfe list" in event.deep_get("CommandLine", default=""),
                                    "diskdrive " in event.deep_get("CommandLine", default=""),
                                    "csproduct " in event.deep_get("CommandLine", default=""),
                                    "computersystem " in event.deep_get("CommandLine", default=""),
                                    " os " in event.deep_get("CommandLine", default=""),
                                    event.deep_get("CommandLine", default="") != "",
                                ]
                            ),
                        ]
                    ),
                ]
            ),
            not all(
                [
                    "\\Program Files\\Amazon\\WorkspacesConfig\\Scripts\\"
                    in event.deep_get("ParentCommandLine", default=""),
                    "\\Program Files\\Amazon\\WorkspacesConfig\\Scripts\\"
                    in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
