def rule(event):
    if all(
        [
            event.deep_get("Provider_Name", default="") == "MsiInstaller",
            event.deep_get("EventID", default="") in [1040, 1042],
            any(
                [
                    ":\\Windows\\TEMP\\" in event.deep_get("Data", default=""),
                    "\\\\" in event.deep_get("Data", default=""),
                    "\\Desktop\\" in event.deep_get("Data", default=""),
                    "\\PerfLogs\\" in event.deep_get("Data", default=""),
                    "\\Users\\Public\\" in event.deep_get("Data", default=""),
                ]
            ),
            not any(
                [
                    "\\AppData\\Local\\Temp\\WinGet\\" in event.deep_get("Data", default=""),
                    "C:\\Windows\\TEMP\\UpdHealthTools.msi" in event.deep_get("Data", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
