def rule(event):
    if all(
        [
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell_ise.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["powershell.exe", "pwsh.dll", "powershell_ise.exe"],
                ]
            ),
            "New-ADServiceAccount" in event.deep_get("CommandLine", default=""),
            "-CreateDelegatedServiceAccount" in event.deep_get("CommandLine", default=""),
            "-path" in event.deep_get("CommandLine", default=""),
        ]
    ):
        return True
    return False
