def rule(event):
    if all(
        [
            event.deep_get("Provider_Name", default="") == "Service Control Manager",
            event.deep_get("EventID", default="") == 7045,
            any(
                [
                    all(
                        [
                            "ADMIN$" in event.deep_get("ImagePath", default=""),
                            ".exe" in event.deep_get("ImagePath", default=""),
                        ]
                    ),
                    all(
                        [
                            "%COMSPEC%" in event.deep_get("ImagePath", default=""),
                            "start" in event.deep_get("ImagePath", default=""),
                            "powershell" in event.deep_get("ImagePath", default=""),
                        ]
                    ),
                    "powershell -nop -w hidden -encodedcommand"
                    in event.deep_get("ImagePath", default=""),
                    any(
                        [
                            "SUVYIChOZXctT2JqZWN0IE5ldC5XZWJjbGllbnQpLkRvd25sb2FkU3RyaW5nKCdodHRwOi8vMTI3LjAuMC4xO"
                            in event.deep_get("ImagePath", default=""),
                            "lFWCAoTmV3LU9iamVjdCBOZXQuV2ViY2xpZW50KS5Eb3dubG9hZFN0cmluZygnaHR0cDovLzEyNy4wLjAuMT"
                            in event.deep_get("ImagePath", default=""),
                            "JRVggKE5ldy1PYmplY3QgTmV0LldlYmNsaWVudCkuRG93bmxvYWRTdHJpbmcoJ2h0dHA6Ly8xMjcuMC4wLjE6"
                            in event.deep_get("ImagePath", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
