Skip to content

Instantly share code, notes, and snippets.

@victorgare
Created May 29, 2025 17:07
Show Gist options
  • Save victorgare/de0cf123b51373dc21f3ea3496b14370 to your computer and use it in GitHub Desktop.
Save victorgare/de0cf123b51373dc21f3ea3496b14370 to your computer and use it in GitHub Desktop.
Unblock TS blacklist
$hostsPath = "$env:SystemRoot\System32\drivers\etc\hosts"
$entry = "0.0.0.0 blacklist2.teamspeak.com"
# Verifica se a linha já existe
$exists = Select-String -Path $hostsPath -Pattern [regex]::Escape($entry) -Quiet
if (-not $exists) {
try {
Add-Content -Path $hostsPath -Value $entry
Write-Host "Entrada adicionada com sucesso ao arquivo hosts." -ForegroundColor Green
} catch {
Write-Host "Erro ao tentar adicionar a entrada. Execute como administrador." -ForegroundColor Red
}
} else {
Write-Host "A entrada já existe no arquivo hosts." -ForegroundColor Yellow
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment