forked from VRPirates/rookie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddDefenderExceptions.ps1
31 lines (27 loc) · 1.07 KB
/
AddDefenderExceptions.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Run this script as Administrator
# powershell -ExecutionPolicy Bypass -File "C:\RSL\Rookie\AddDefenderExceptions.ps1"
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Please run this script as Administrator!"
exit
}
$paths = @(
"C:\RSL",
"C:\RSL\Rookie",
"C:\RSL\Rookie\rclone",
"C:\RSL\Rookie\Sideloader Launcher.exe",
"C:\RSL\Rookie\AndroidSideloader*.exe",
"C:\RSL\Rookie\rclone\rclone.exe"
)
foreach ($path in $paths) {
try {
Add-MpPreference -ExclusionPath $path -ErrorAction Stop
Write-Host "Successfully added exclusion for: $path" -ForegroundColor Green
}
catch {
Write-Host "Failed to add exclusion for: $path" -ForegroundColor Red
Write-Host "Error: $_" -ForegroundColor Red
}
}
# Verify the exclusions
Write-Host "`nCurrent exclusions:" -ForegroundColor Cyan
Get-MpPreference | Select-Object -ExpandProperty ExclusionPath | Where-Object { $_ -like "C:\RSL*" }