Skip to content

Instantly share code, notes, and snippets.

@ebubekirbastama
Created January 30, 2026 18:29
Show Gist options
  • Select an option

  • Save ebubekirbastama/aac90f0c848312e662a2027313f3a68b to your computer and use it in GitHub Desktop.

Select an option

Save ebubekirbastama/aac90f0c848312e662a2027313f3a68b to your computer and use it in GitHub Desktop.
# ==========================================
# Windows 10/11 - RDP AKTIF (OTOMATIK ADMIN)
# ==========================================
# ---- ADMIN KONTROL (OTOMATIK YUKSELTME) ----
if (-not ([Security.Principal.WindowsPrincipal] `
[Security.Principal.WindowsIdentity]::GetCurrent()
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Yonetici yetkisi yok, yeniden baslatiliyor..." -ForegroundColor Yellow
Start-Process powershell `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
# ---- BASLANGIC ----
Write-Host "RDP ayarlari baslatiliyor..." -ForegroundColor Cyan
# 1) RDP AKTIF ET
Set-ItemProperty `
-Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server" `
-Name "fDenyTSConnections" -Value 0
# 2) RDP SERVISI
Set-Service -Name TermService -StartupType Automatic
Start-Service -Name TermService
# 3) GUVENLIK DUVARI (RDP)
Enable-NetFirewallRule -DisplayGroup "Uzak Masaüstü" -ErrorAction SilentlyContinue
# 4) 3389 PORTU (YEDEK KURAL)
if (-not (Get-NetFirewallRule -DisplayName "RDP 3389" -ErrorAction SilentlyContinue)) {
New-NetFirewallRule `
-DisplayName "RDP 3389" `
-Direction Inbound `
-Protocol TCP `
-LocalPort 3389 `
-Action Allow
}
# 5) MEVCUT KULLANICIYI RDP GRUBUNA EKLE (GERI UYUMLU)
net localgroup "Remote Desktop Users" "$env:USERNAME" /add | Out-Null
# 6) NLA (GUVENLI GIRIS)
Set-ItemProperty `
-Path "HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" `
-Name "UserAuthentication" -Value 1
# 7) DURUM KONTROL
$service = Get-Service TermService
Write-Host "----------------------------------" -ForegroundColor Yellow
Write-Host "RDP Servis Durumu : $($service.Status)" -ForegroundColor Green
Write-Host "Bilgisayar Adi : $env:COMPUTERNAME" -ForegroundColor Cyan
Write-Host "Kullanici : $env:USERNAME" -ForegroundColor Cyan
Write-Host "----------------------------------" -ForegroundColor Yellow
Write-Host "RDP AKTIF. mstsc ile baglanabilirsin." -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment