def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\powershell.exe"),
                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                ]
            ),
            any(
                [
                    "\\WindowsPowerShell\\Modules\\"
                    in event.deep_get("TargetFilename", default=""),
                    "\\PowerShell\\7\\Modules\\" in event.deep_get("TargetFilename", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
