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("\\reg.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["PowerShell.EXE", "pwsh.dll", "reg.exe"],
                ]
            ),
            any(
                [
                    "add " in event.deep_get("CommandLine", default=""),
                    "New-ItemProperty " in event.deep_get("CommandLine", default=""),
                    "Set-ItemProperty " in event.deep_get("CommandLine", default=""),
                    "si " in event.deep_get("CommandLine", default=""),
                    "delete " in event.deep_get("CommandLine", default=""),
                    "del " in event.deep_get("CommandLine", default=""),
                    "Remove-ItemProperty " in event.deep_get("CommandLine", default=""),
                    "rp " in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    "\\Control\\DeviceGuard" in event.deep_get("CommandLine", default=""),
                    "\\Control\\LSA" in event.deep_get("CommandLine", default=""),
                    "Software\\Policies\\Microsoft\\Windows\\DeviceGuard"
                    in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    "EnableVirtualizationBasedSecurity"
                    in event.deep_get("CommandLine", default=""),
                    "RequirePlatformSecurityFeatures" in event.deep_get("CommandLine", default=""),
                    "LsaCfgFlags" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
