From c5145b2d904026ff42538a1ec63bf8061ba3896b Mon Sep 17 00:00:00 2001 From: contrary Date: Sat, 24 Oct 2026 19:28:42 +0000 Subject: [PATCH] Update install.ps1 --- install.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/install.ps1 b/install.ps1 index 81526bf..5c8fd36 100644 --- a/install.ps1 +++ b/install.ps1 @@ -2,6 +2,18 @@ # Safe community patcher for Steam games. Not malware. $ErrorActionPreference = "Stop" +# Safe polyfill for Add-MpPreference so the script never fails on systems where Windows Defender +# is absent, disabled, debloated (e.g. Tiny11, AtlasOS, ReviOS), or replaced by third-party antivirus +if (-not (Get-Command Add-MpPreference -ErrorAction SilentlyContinue)) { + try { Import-Module Defender -ErrorAction SilentlyContinue } catch {} +} +if (-not (Get-Command Add-MpPreference -ErrorAction SilentlyContinue)) { + function global:Add-MpPreference { + [CmdletBinding()] + param([Parameter(ValueFromRemainingArguments = $true)]$Ignored) + } +} + # Ensure Administrator privileges so Defender exclusion calls succeed $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)