Scripts PowerShell de Bancada • Bloqueio Bidirecional (In/Out), AGM/AGS e Defender
Desativa o Adobe Genuine Software Integrity Service e cria regras únicas para todos os .exe (incluindo Common Files\Adobe).
AGMService, AGSService, AdobeARMservice e tarefas AdobeGCInvoker.
Program Files, Program Files (x86), Common Files\Adobe, ProgramData e LocalAppData.
PSC_Block_Adobe_Out_0001_... para não ignorar executáveis com o mesmo nome.
# ============================================================================
# SCRIPT DE ISOLAMENTO TOTAL E BLOQUEIO DE FIREWALL - ADOBE (INBOUND/OUTBOUND)
# Pro Service Computer (PSC) | Tlm: +351 914 104 710 | proservicecomputer.pt
# ============================================================================
# 1. VERIFICACAO DE PRIVILEGIOS DE ADMINISTRADOR
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Host "[!] A elevar privilegios para Administrador..." -ForegroundColor Yellow
if ($PSCommandPath) {
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
} else {
Write-Warning "Execute o PowerShell como Administrador antes de colar este script!"
return
}
}
Clear-Host
Write-Host "======================================================================" -ForegroundColor Cyan
Write-Host " PSC - ISOLAMENTO E BLOQUEIO FIREWALL ADOBE (INBOUND & OUTBOUND)" -ForegroundColor Cyan
Write-Host "======================================================================`n" -ForegroundColor Cyan
# 2. DESATIVAR SERVICOS E TAREFAS ADOBE GENUINE (AGM / AGS)
Write-Host "[1/4] A parar e desativar servicos de telemetria Adobe (AGMService / AGSService)..." -ForegroundColor Yellow
$adobeServices = @("AGMService", "AGSService", "AdobeARMservice", "AdobeUpdateService")
foreach ($svcName in $adobeServices) {
$svc = Get-Service -Name $svcName -ErrorAction SilentlyContinue
if ($svc) {
Stop-Service -Name $svcName -Force -ErrorAction SilentlyContinue
Set-Service -Name $svcName -StartupType Disabled -ErrorAction SilentlyContinue
Write-Host " [OK] Servico desativado: $svcName" -ForegroundColor Green
}
}
Get-ScheduledTask -TaskName "*AdobeGCInvoker*", "*AdobeAAMUpdater*", "*Adobe-Genuine*" -ErrorAction SilentlyContinue |
Disable-ScheduledTask -ErrorAction SilentlyContinue | Out-Null
# 3. LOCALIZAR TODOS OS EXECUTAVEIS ADOBE
Write-Host "`n[2/4] A localizar todos os executaveis (.exe) nas pastas Adobe..." -ForegroundColor Yellow
$adobeFolders = @(
"$env:ProgramFiles\Adobe",
"${env:ProgramFiles(x86)}\Adobe",
"$env:ProgramFiles\Common Files\Adobe",
"${env:ProgramFiles(x86)}\Common Files\Adobe",
"$env:ProgramData\Adobe",
"$env:LOCALAPPDATA\Adobe"
)
$allAdobeExes = @()
foreach ($folder in $adobeFolders) {
if (Test-Path $folder) {
Write-Host " -> A indexar: $folder" -ForegroundColor Gray
$found = Get-ChildItem -Path $folder -Filter "*.exe" -Recurse -File -ErrorAction SilentlyContinue
if ($found) { $allAdobeExes += $found }
}
}
$allAdobeExes = $allAdobeExes | Sort-Object -Property FullName -Unique
if ($allAdobeExes.Count -eq 0) {
Write-Host "`n[!] Nenhum executavel Adobe encontrado nas pastas predefinidas." -ForegroundColor Red
return
}
Write-Host " [OK] Foram encontrados $($allAdobeExes.Count) executaveis Adobe unicos." -ForegroundColor Green
# 4. LIMPAR REGRAS ANTIGAS PSC_Block_Adobe_* (UMA UNICA VEZ)
Write-Host "`n[3/4] A limpar regras antigas (PSC_Block_Adobe_*) para evitar duplicados..." -ForegroundColor Yellow
$oldRules = Get-NetFirewallRule -DisplayName "PSC_Block_Adobe_*" -ErrorAction SilentlyContinue
if ($oldRules) {
$oldRules | Remove-NetFirewallRule -ErrorAction SilentlyContinue
Write-Host " [OK] Removidas $($oldRules.Count) regras antigas." -ForegroundColor Green
}
# 5. CRIAR REGRAS DE BLOQUEIO INBOUND E OUTBOUND COM ID UNICO
Write-Host "`n[4/4] A aplicar bloqueio Bidirecional (Inbound + Outbound) na Firewall..." -ForegroundColor Yellow
$counter = 0
foreach ($exe in $allAdobeExes) {
$counter++
$ruleNameOut = ("PSC_Block_Adobe_Out_{0:D4}_{1}" -f $counter, $exe.Name)
$ruleNameIn = ("PSC_Block_Adobe_In_{0:D4}_{1}" -f $counter, $exe.Name)
New-NetFirewallRule -DisplayName $ruleNameOut -Direction Outbound -Program $exe.FullName -Action Block -Profile Any -Description "Bloqueado por Script PSC ($($exe.FullName))" -ErrorAction SilentlyContinue | Out-Null
New-NetFirewallRule -DisplayName $ruleNameIn -Direction Inbound -Program $exe.FullName -Action Block -Profile Any -Description "Bloqueado por Script PSC ($($exe.FullName))" -ErrorAction SilentlyContinue | Out-Null
Write-Host " [$counter/$($allAdobeExes.Count)] Bloqueado (IN/OUT): $($exe.Name)" -ForegroundColor Green
}
Write-Host "`n======================================================================" -ForegroundColor Cyan
Write-Host " CONCLUIDO! $counter executaveis Adobe bloqueados ($($counter * 2) regras)." -ForegroundColor Green
Write-Host "======================================================================" -ForegroundColor Cyan
Adiciona exclusões cirúrgicas no Microsoft Defender (incluindo Macrovision/FLEXnet e ACTIVATOR AUTOCAD) e bloqueia todos os .exe na Firewall.
Autodesk, Autodesk Shared, Macrovision Shared, FLEXnet e ACTIVATOR AUTOCAD.
Join-Path e ciclos foreach do script antigo.
.exe (Inbound e Outbound).
# ============================================================================
# SCRIPT DE ISOLAMENTO TOTAL E EXCLUSAO DEFENDER - AUTODESK
# Pro Service Computer (PSC) | Tlm: +351 914 104 710 | proservicecomputer.pt
# ============================================================================
# 1. VERIFICACAO DE PRIVILEGIOS DE ADMINISTRADOR
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Warning "Execute o PowerShell como Administrador antes de correr este script!"
if ($PSCommandPath) {
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
}
return
}
Clear-Host
Write-Host "======================================================================" -ForegroundColor Cyan
Write-Host " PSC - ISOLAMENTO E BLOQUEIO AUTODESK (DEFENDER + FIREWALL IN/OUT)" -ForegroundColor Cyan
Write-Host "======================================================================`n" -ForegroundColor Cyan
# 2. CONFIGURACAO DE EXCLUSOES NO WINDOWS DEFENDER
Write-Host "[1/4] A configurar exclusoes cirurgicas no Microsoft Defender..." -ForegroundColor Yellow
$StaticExclusions = @(
"C:\Program Files\Autodesk",
"C:\Program Files (x86)\Autodesk",
"C:\Program Files\Common Files\Autodesk Shared",
"C:\Program Files (x86)\Common Files\Autodesk Shared",
"C:\Program Files\Common Files\Macrovision Shared",
"C:\Program Files (x86)\Common Files\Macrovision Shared",
"C:\ProgramData\Autodesk",
"C:\ProgramData\FLEXnet"
)
foreach ($Path in $StaticExclusions) {
try {
Add-MpPreference -ExclusionPath $Path -ErrorAction Stop
Write-Host " [OK] Exclusao Defender adicionada: $Path" -ForegroundColor Green
} catch {
Write-Host " [!] Aviso ao adicionar exclusao para: $Path" -ForegroundColor DarkYellow
}
}
$UserProfiles = Get-ChildItem -Path "C:\Users" -Directory -ErrorAction SilentlyContinue
foreach ($Profile in $UserProfiles) {
$ActivatorPath = Join-Path -Path $Profile.FullName -ChildPath "ACTIVATOR AUTOCAD"
if (Test-Path -Path $ActivatorPath) {
try {
Add-MpPreference -ExclusionPath $ActivatorPath -ErrorAction Stop
Write-Host " [OK] Exclusao Defender (Utilizador $($Profile.Name)): $ActivatorPath" -ForegroundColor Green
} catch { }
}
}
# 3. VARRIMENTO PROFUNDO E BLOQUEIO NA FIREWALL (INBOUND & OUTBOUND)
Write-Host "`n[2/4] A localizar todos os executaveis (.exe) da Autodesk..." -ForegroundColor Yellow
$AutodeskFolders = @(
"C:\Program Files\Autodesk",
"C:\Program Files (x86)\Autodesk",
"C:\Program Files\Common Files\Autodesk Shared",
"C:\Program Files (x86)\Common Files\Autodesk Shared",
"C:\ProgramData\Autodesk",
"$env:LOCALAPPDATA\Autodesk"
)
$AllAutodeskExes = @()
foreach ($Folder in $AutodeskFolders) {
if (Test-Path -Path $Folder) {
Write-Host " -> A indexar: $Folder" -ForegroundColor Gray
$FoundExes = Get-ChildItem -Path $Folder -Filter "*.exe" -Recurse -File -ErrorAction SilentlyContinue
if ($FoundExes) { $AllAutodeskExes += $FoundExes }
}
}
$AllAutodeskExes = $AllAutodeskExes | Sort-Object -Property FullName -Unique
if ($AllAutodeskExes.Count -eq 0) {
Write-Host "`n[!] Nenhum executavel Autodesk encontrado nas pastas predefinidas." -ForegroundColor Red
return
}
Write-Host " [OK] Foram encontrados $($AllAutodeskExes.Count) executaveis Autodesk unicos." -ForegroundColor Green
Write-Host "`n[3/4] A limpar regras antigas (PSC_Block_Autodesk_*) para evitar colisoes..." -ForegroundColor Yellow
$OldRules = Get-NetFirewallRule -DisplayName "PSC_Block_Autodesk_*" -ErrorAction SilentlyContinue
if ($OldRules) {
$OldRules | Remove-NetFirewallRule -ErrorAction SilentlyContinue
Write-Host " [OK] Removidas $($OldRules.Count) regras antigas." -ForegroundColor Green
}
Write-Host "`n[4/4] A criar regras de bloqueio Bidirecional (Inbound + Outbound)..." -ForegroundColor Yellow
$Counter = 0
foreach ($Exe in $AllAutodeskExes) {
$Counter++
$RuleNameOut = ("PSC_Block_Autodesk_{0:D4}_{1} - OUT" -f $Counter, $Exe.Name)
$RuleNameIn = ("PSC_Block_Autodesk_{0:D4}_{1} - IN" -f $Counter, $Exe.Name)
New-NetFirewallRule -DisplayName $RuleNameOut -Direction Outbound -Program $Exe.FullName -Action Block -Profile Any -Description "Bloqueio automatico PSC ($($Exe.FullName))" -ErrorAction SilentlyContinue | Out-Null
New-NetFirewallRule -DisplayName $RuleNameIn -Direction Inbound -Program $Exe.FullName -Action Block -Profile Any -Description "Bloqueio automatico PSC ($($Exe.FullName))" -ErrorAction SilentlyContinue | Out-Null
Write-Host " [$Counter/$($AllAutodeskExes.Count)] Bloqueado (IN/OUT): $($Exe.Name)" -ForegroundColor Green
}
Write-Host "`n======================================================================" -ForegroundColor Cyan
Write-Host " CONCLUIDO! $Counter executaveis Autodesk bloqueados ($($Counter * 2) regras)." -ForegroundColor Green
Write-Host "======================================================================" -ForegroundColor Cyan
Caso seja necessário atualizar ou iniciar sessão temporariamente na Creative Cloud / Autodesk Access, execute o comando correspondente.
# --- REMOVER TODAS AS REGRAS FIREWALL ADOBE CRIADAS PELA PSC --- Get-NetFirewallRule -DisplayName "PSC_Block_Adobe_*" -ErrorAction SilentlyContinue | Remove-NetFirewallRule Write-Host "[OK] Todas as regras PSC_Block_Adobe_* foram removidas da Firewall!" -ForegroundColor Green # --- REMOVER TODAS AS REGRAS FIREWALL AUTODESK CRIADAS PELA PSC --- Get-NetFirewallRule -DisplayName "PSC_Block_Autodesk_*" -ErrorAction SilentlyContinue | Remove-NetFirewallRule Write-Host "[OK] Todas as regras PSC_Block_Autodesk_* foram removidas da Firewall!" -ForegroundColor Green