def rule(event):
    if all(
        [
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\wmic.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["wmic.exe", "PowerShell.EXE", "pwsh.dll"],
                ]
            ),
            any(
                [
                    "rdtoggle" in event.deep_get("CommandLine", default=""),
                    "Win32_TerminalServiceSetting" in event.deep_get("CommandLine", default=""),
                ]
            ),
            "SetAllowTSConnections" in event.deep_get("CommandLine", default=""),
        ]
    ):
        return True
    return False
