# civpb.com - lets two players be in the Pitboss game at the same time. # Points the dead GameSpy "NAT negotiation" hostnames at civpb.com, which # brokers and relays the direct connection between two players. # What it does: back up hosts, drop older natneg lines, append ours, flush DNS. $ErrorActionPreference = 'Stop' $p = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() if (-not $p.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "Please open PowerShell or Command Prompt AS ADMINISTRATOR and run the line again." -ForegroundColor Yellow exit 1 } $h = Join-Path $env:SystemRoot 'System32\drivers\etc\hosts' Copy-Item $h "$h.civpb-backup" -Force $keep = @(Get-Content $h | Where-Object { $_ -notmatch 'natneg' }) $add = @((Invoke-WebRequest -UseBasicParsing 'https://civpb.com/files/hosts-natneg.txt').Content -split "`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ -and $_ -notmatch '^#' }) Set-Content -Path $h -Value ($keep + $add) -Encoding ASCII ipconfig /flushdns | Out-Null Write-Host "Done - civpb.com now brokers your connections to other players." -ForegroundColor Green Write-Host "(previous hosts file saved as hosts.civpb-backup)"