def rule(event):
    if all(
        [
            event.deep_get("PipeName", default="").startswith("\\PSHost"),
            not any(
                [
                    any(
                        [
                            any(
                                [
                                    ":\\Program Files\\PowerShell\\7-preview\\pwsh.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Program Files\\PowerShell\\7\\pwsh.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\system32\\dsac.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\system32\\inetsrv\\w3wp.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\System32\\sdiagnhost.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\system32\\ServerManager.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\system32\\wbem\\wmiprvse.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell_ise.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\System32\\wsmprovhost.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell_ise.exe"
                                    in event.deep_get("Image", default=""),
                                    ":\\Windows\\SysWOW64\\WindowsPowerShell\\v1.0\\powershell.exe"
                                    in event.deep_get("Image", default=""),
                                ]
                            ),
                            all(
                                [
                                    "C:\\Program Files\\WindowsApps\\Microsoft.PowerShellPreview"
                                    in event.deep_get("Image", default=""),
                                    "\\pwsh.exe" in event.deep_get("Image", default=""),
                                ]
                            ),
                            all(
                                [
                                    "\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.PowerShellPreview"
                                    in event.deep_get("Image", default=""),
                                    "\\pwsh.exe" in event.deep_get("Image", default=""),
                                ]
                            ),
                        ]
                    ),
                    event.deep_get("Image", default="") == "",
                ]
            ),
            not any(
                [
                    all(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Program Files (x86)\\"
                                    ),
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Program Files\\"
                                    ),
                                ]
                            ),
                            "\\Microsoft SQL Server\\" in event.deep_get("Image", default=""),
                            event.deep_get("Image", default="").endswith(
                                "\\Tools\\Binn\\SQLPS.exe"
                            ),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("Image", default="").startswith(
                                "C:\\Program Files\\AzureConnectedMachineAgent\\GCArcService"
                            ),
                            event.deep_get("Image", default="").endswith("\\GC\\gc_worker.exe"),
                        ]
                    ),
                    event.deep_get("Image", default="").startswith("C:\\Program Files\\Citrix\\"),
                    event.deep_get("Image", default="").startswith(
                        "C:\\Program Files\\Microsoft\\Exchange Server\\"
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
