Windows Server kurulumu tamamlandıktan sonra, sunucunuzu üretime almadan önce mutlaka değiştirmeniz gereken kritik varsayılan ayarlar vardır. Microsoft, kullanışlılık ve erişilebilirlik açısından Windows Server’ı belirli bir dengeyle yapılandırmıştır, ancak bu varsayılan ayarlar genellikle maksimum güvenlik sağlamaz. Bu yazıda, 15+ yıllık sistem yöneticiliği deneyimim boyunca her Windows Server kurulumunda mutlaka değiştirdiğim 7 kritik ayarı ve bunların neden önemli olduğunu anlatacağım.
Neden Windows Server Varsayılan Ayarları Değiştirmek Gerekli?
Windows Server, “out-of-the-box” güvenli olacak şekilde tasarlanmış olsa da, birçok organizasyon güvenlik konfigürasyonları üzerinde daha ayrıntılı kontrol istemektedir. Microsoft’un güvenlik uzmanları şunu söylüyor: Microsoft 3,000’den fazla grup policy ayarı sunar ve bunlardan sadece bir kısmı güvenlik ile ilgilidir. Bu nedenle, doğru konfigürasyonları uygulamak kritiktir.
Temel Prensipler:
- Varsayılan ayarlar genellikle kullanıcı dostu ama güvenlik odaklı değildir
- Her sunucu rolü farklı güvenlik gereksinimleri gerektirir
- Güvenlik katmanları (defense in depth) yaklaşımı benimsenmelidir
- Saldırı yüzeyini minimize etmek temel hedeftir
1. Administrator Hesabını Yeniden Adlandırma ve Güçlendirme
Varsayılan Durum Problemi
Windows Server kurulumu sırasında oluşturulan yerleşik “Administrator” hesabı, tüm dünyada bilinen standart bir hesap adıdır. Bu, brute-force saldırıları için birincil hedeftir.
Yapılması Gerekenler
A. Administrator Hesabını Yeniden Adlandırma
GUI Yöntemi:
1. Computer Management > Local Users and Groups > Users
2. Administrator hesabına sağ tık > Rename
3. Benzersiz bir isim verin (örn: SysAdmin2024, ServerManager, vb.)
PowerShell Yöntemi:
# Administrator hesabını yeniden adlandır
Rename-LocalUser -Name "Administrator" -NewName "SystemManager"
# Hesap durumunu kontrol et
Get-LocalUser -Name "SystemManager"
Group Policy ile Toplu Değişiklik:
Computer Configuration > Windows Settings > Security Settings >
Local Policies > Security Options >
"Accounts: Rename administrator account"
B. Güçlü Parola Politikası Uygulama
# Güçlü parola belirleme
$SecurePassword = ConvertTo-SecureString "KarmaşıkParola123!@#" -AsPlainText -Force
Set-LocalUser -Name "SystemManager" -Password $SecurePassword
# Parola süresiz yap (opsiyonel)
Set-LocalUser -Name "SystemManager" -PasswordNeverExpires $true
C. Hesap Kilitleme Politikası
Local Security Policy ile:
Security Settings > Account Policies > Account Lockout Policy
Account lockout threshold: 3
Account lockout duration: 30 minutes
Reset account lockout counter after: 15 minutes
PowerShell ile:
# Hesap kilitleme politikası ayarlama
secedit /export /cfg c:\temp\secpol.cfg
# Dosyayı düzenle ve tekrar import et
secedit /configure /db c:\windows\security\local.sdb /cfg c:\temp\secpol.cfg
2. User Account Control (UAC) Yapılandırması
Varsayılan Durum Problemi
Windows Server’da UAC varsayılan olarak aktiftir ancak optimum güvenlik seviyesinde değildir. Ayrıca, built-in Administrator hesabı için UAC varsayılan olarak devre dışıdır.
UAC Seviyelerini Anlama
UAC Seviyeleri:
- Never notify (En düşük güvenlik)
- Notify me only when apps try to make changes (Varsayılan)
- Always notify (En yüksek güvenlik)
Optimal UAC Konfigürasyonu
A. Registry ile UAC Ayarlama
# UAC'ı maksimum seviyeye ayarla
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 2
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "PromptOnSecureDesktop" -Value 1
# Built-in Administrator için UAC aktif et
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "FilterAdministratorToken" -Value 1
B. Group Policy ile UAC Konfigürasyonu
Computer Configuration > Windows Settings > Security Settings >
Local Policies > Security Options
- User Account Control: Admin Approval Mode for Built-in Administrator = Enabled
- User Account Control: Behavior of elevation prompt for administrators = Prompt for consent on secure desktop
- User Account Control: Run all administrators in Admin Approval Mode = Enabled
- User Account Control: Switch to secure desktop when prompting = Enabled
C. UAC Monitoring Script’i
# UAC durumunu kontrol eden script
function Check-UACStatus {
$UACEnabled = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA"
$AdminBehavior = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin"
Write-Host "UAC Status:"
Write-Host "EnableLUA: $($UACEnabled.EnableLUA)"
Write-Host "Admin Prompt Behavior: $($AdminBehavior.ConsentPromptBehaviorAdmin)"
if ($UACEnabled.EnableLUA -eq 1 -and $AdminBehavior.ConsentPromptBehaviorAdmin -eq 2) {
Write-Host "UAC is properly configured!" -ForegroundColor Green
} else {
Write-Host "UAC needs configuration!" -ForegroundColor Red
}
}
Check-UACStatus
3. Windows Firewall Yapılandırması ve Sertleştirme
Varsayılan Durum Problemi
Windows Firewall aktiftir ancak birçok gereksiz kural ve servis açıktır. Ayrıca logging genellikle etkin değildir.
Optimal Firewall Konfigürasyonu
A. Temel Firewall Sertleştirme
# Tüm profiller için varsayılan politikaları ayarla
Set-NetFirewallProfile -Profile Domain,Public,Private -DefaultInboundAction Block
Set-NetFirewallProfile -Profile Domain,Public,Private -DefaultOutboundAction Allow
# Logging'i aktif et
Set-NetFirewallProfile -Profile Domain,Public,Private -LogAllowed True -LogBlocked True -LogMaxSizeKilobytes 32767
Set-NetFirewallProfile -Profile Domain,Public,Private -LogFileName "%SystemRoot%\System32\LogFiles\Firewall\pfirewall.log"
# Firewall bildirimlerini aktif et
Set-NetFirewallProfile -Profile Domain,Public,Private -NotifyOnListen True
B. Gereksiz Kuralları Devre Dışı Bırakma
# Yaygın olarak gereksiz olan kuralları devre dışı bırak
$DisableRules = @(
"*AllJoyn*",
"*Cast to Device*",
"*mDNS*",
"*Wireless Display*",
"*WLAN Service*",
"*Windows Media Player*"
)
foreach ($rule in $DisableRules) {
Disable-NetFirewallRule -DisplayName $rule -ErrorAction SilentlyContinue
Write-Host "Disabled: $rule"
}
C. Remote Desktop Port Değiştirme
# RDP portunu varsayılan 3389'dan değiştir
$NewRDPPort = 6689
# Registry'de RDP portunu değiştir
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "PortNumber" -Value $NewRDPPort
# Firewall kuralını güncelle
New-NetFirewallRule -DisplayName "Remote Desktop - Custom Port" -Direction Inbound -Protocol TCP -LocalPort $NewRDPPort -Action Allow
# Eski RDP kuralını devre dışı bırak
Disable-NetFirewallRule -DisplayName "Remote Desktop*"
Write-Host "RDP port changed to: $NewRDPPort"
Write-Host "Remember to add this port to your RDP client!"
D. Network Level Authentication Zorla
# Network Level Authentication'ı aktif et
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "SecurityLayer" -Value 1
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" -Name "UserAuthentication" -Value 1
# RDP servisini yeniden başlat
Restart-Service TermService -Force
4. Otomatik Windows Update Konfigürasyonu
Varsayılan Durum Problemi
Windows Server varsayılan olarak manuel güncelleme modundadır. Bu güvenlik açıklarının kapatılmamasına neden olabilir.
Optimal Update Konfigürasyonu
A. Otomatik Güncelleme Ayarlama
# Windows Update servisini aktif et
Set-Service -Name wuauserv -StartupType Automatic
Start-Service wuauserv
# Otomatik güncellemeleri aktif et
$AUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$AUSettings.NotificationLevel = 4 # Automatically download and install
$AUSettings.ScheduledInstallationDay = 0 # Every day
$AUSettings.ScheduledInstallationTime = 3 # 3 AM
$AUSettings.IncludeRecommendedUpdates = $true
$AUSettings.Save()
B. Registry ile Update Politikası
# Windows Update registry ayarları
$UpdatePath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU"
if (!(Test-Path $UpdatePath)) {
New-Item -Path $UpdatePath -Force
}
Set-ItemProperty -Path $UpdatePath -Name "AUOptions" -Value 4 # Auto download and install
Set-ItemProperty -Path $UpdatePath -Name "ScheduledInstallDay" -Value 0 # Every day
Set-ItemProperty -Path $UpdatePath -Name "ScheduledInstallTime" -Value 3 # 3 AM
Set-ItemProperty -Path $UpdatePath -Name "AutoInstallMinorUpdates" -Value 1 # Install minor updates
Set-ItemProperty -Path $UpdatePath -Name "IncludeRecommendedUpdates" -Value 1 # Include recommended updates
C. WSUS Konfigürasyonu (Kurumsal Ortamlar İçin)
# WSUS sunucu konfigürasyonu
$WSUSServer = "http://wsus.yourdomain.com:8530"
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUServer" -Value $WSUSServer
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" -Name "WUStatusServer" -Value $WSUSServer
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "UseWUServer" -Value 1
# Güncelleme servisini yeniden başlat
Restart-Service wuauserv
D. Update Status Monitoring Script’i
# Windows Update durumunu kontrol eden script
function Get-WindowsUpdateStatus {
$Session = New-Object -ComObject Microsoft.Update.Session
$Searcher = $Session.CreateupdateSearcher()
try {
$Updates = $Searcher.Search("IsInstalled=0")
$PendingUpdates = $Updates.Updates.Count
Write-Host "Windows Update Status:" -ForegroundColor Cyan
Write-Host "Pending Updates: $PendingUpdates" -ForegroundColor $(if($PendingUpdates -gt 0){"Red"}else{"Green"})
if ($PendingUpdates -gt 0) {
foreach ($Update in $Updates.Updates) {
Write-Host "- $($Update.Title)" -ForegroundColor Yellow
}
}
# Son yüklenen güncellemeleri göster
$LastInstalled = Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 5
Write-Host "`nLast 5 Installed Updates:" -ForegroundColor Cyan
$LastInstalled | Format-Table HotFixID, Description, InstalledOn -AutoSize
} catch {
Write-Host "Error checking updates: $($_.Exception.Message)" -ForegroundColor Red
}
}
Get-WindowsUpdateStatus
5. Gereksiz Windows Servislerini Devre Dışı Bırakma
Varsayılan Durum Problemi
Windows Server birçok servisle gelir ve bunların çoğu tipik sunucu operasyonları için gerekli değildir. Microsoft, güvenlik odaklı dağıtımlar için bu ayarların değiştirilmesini önermektedir.
Güvenli Şekilde Devre Dışı Bırakılabilecek Servisler
A. Print Spooler Servisi
# Print Spooler - En yaygın saldırı vektörlerinden biri
Stop-Service -Name Spooler -Force
Set-Service -Name Spooler -StartupType Disabled
Write-Host "Print Spooler disabled - Major security improvement!"
B. Remote Registry Servisi
# Remote Registry - Uzaktan registry erişimini engelle
Stop-Service -Name RemoteRegistry -Force
Set-Service -Name RemoteRegistry -StartupType Disabled
Write-Host "Remote Registry disabled!"
C. Diğer Güvenlik Riski Oluşturan Servisler
# Devre dışı bırakılabilecek servisler listesi
$ServicesToDisable = @(
"Fax", # Fax Service
"TrkWks", # Distributed Link Tracking Client
"MSiSCSI", # Microsoft iSCSI Initiator Service
"WbioSrvc", # Windows Biometric Service
"WerSvc", # Windows Error Reporting Service
"WSearch", # Windows Search (dosya sunucusu değilse)
"SSDPSRV", # SSDP Discovery
"upnphost", # UPnP Device Host
"Browser", # Computer Browser
"LanmanServer" # Server (dosya paylaşımı gerekmiyorsa)
)
foreach ($service in $ServicesToDisable) {
$svc = Get-Service -Name $service -ErrorAction SilentlyContinue
if ($svc) {
if ($svc.Status -eq 'Running') {
Stop-Service -Name $service -Force
}
Set-Service -Name $service -StartupType Disabled
Write-Host "Disabled service: $service" -ForegroundColor Green
}
}
D. Servis Durumu Raporu
function Get-SecurityServiceReport {
$CriticalServices = @(
"Spooler", "RemoteRegistry", "Fax", "TrkWks",
"MSiSCSI", "WbioSrvc", "WerSvc", "SSDPSRV", "upnphost"
)
Write-Host "Security Service Status Report:" -ForegroundColor Cyan
Write-Host "==============================" -ForegroundColor Cyan
foreach ($serviceName in $CriticalServices) {
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($service) {
$status = if ($service.StartType -eq 'Disabled') { "SECURE" } else { "RISK" }
$color = if ($status -eq "SECURE") { "Green" } else { "Red" }
Write-Host "$serviceName : $($service.Status) / $($service.StartType) - $status" -ForegroundColor $color
}
}
}
Get-SecurityServiceReport
6. Zaman ve Saat Konfigürasyonu (NTP Güvenliği)
Varsayılan Durum Problemi
Doğru zaman senkronizasyonu güvenlik log’ları için kritiktir. Varsayılan Windows Time servisi her zaman en güvenli yapılandırmaya sahip değildir.
Güvenli NTP Konfigürasyonu
A. Güvenilir NTP Sunucuları Ayarlama
# Güvenilir NTP sunucularını ayarla
$NTPServers = "time.windows.com,time.nist.gov,pool.ntp.org"
# NTP client'ı durdur
Stop-Service w32time
# NTP konfigürasyonu
w32tm /config /manualpeerlist:$NTPServers /syncfromflags:manual /reliable:yes /update
# Hizmeti başlat
Start-Service w32time
# Zaman senkronizasyonunu zorla
w32tm /resync /force
Write-Host "NTP configuration completed with servers: $NTPServers"
B. Zaman Servisi Güvenlik Ayarları
# Windows Time Service güvenlik ayarları
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" -Name "AnnounceFlags" -Value 5
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" -Name "MaxNegPhaseCorrection" -Value 3600
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Config" -Name "MaxPosPhaseCorrection" -Value 3600
# NTP authentication (kurumsal ortamlar için)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient" -Name "RequireSecureTimeSyncRequests" -Value 1
C. Zaman Senkronizasyonu Monitoring
function Test-TimeSynchronization {
Write-Host "Time Synchronization Status:" -ForegroundColor Cyan
# W32Time servis durumu
$w32timeService = Get-Service w32time
Write-Host "W32Time Service: $($w32timeService.Status)" -ForegroundColor $(if($w32timeService.Status -eq 'Running'){"Green"}else{"Red"})
# Zaman senkronizasyon durumu
$timeSync = w32tm /query /status
Write-Host "`nTime Sync Status:"
$timeSync | Select-String "Last Successful Sync Time", "Source", "Stratum"
# Zaman farkını kontrol et
$ntpQuery = w32tm /stripchart /computer:time.windows.com /samples:1 /dataonly
Write-Host "`nTime Difference Check:"
$ntpQuery
# Local time vs UTC
$localTime = Get-Date
$utcTime = Get-Date -UFormat "%Y-%m-%d %H:%M:%S UTC"
Write-Host "`nLocal Time: $localTime"
Write-Host "UTC Time: $utcTime"
}
Test-TimeSynchronization
7. PowerShell Execution Policy ve Güvenlik Ayarları
Varsayılan Durum Problemi
PowerShell varsayılan olarak script execution’a izin verir, bu da güvenlik riski oluşturabilir. Ayrıca PowerShell v2.0 güvenlik açıklarına sahiptir.
PowerShell Güvenlik Sertleştirme
A. Execution Policy Ayarlama
# Güvenli execution policy ayarla
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
# Tüm kullanıcılar için policy kontrolü
Get-ExecutionPolicy -List
# PowerShell modül logging'i aktif et
$PSModuleLoggingPath = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ModuleLogging"
if (!(Test-Path $PSModuleLoggingPath)) {
New-Item -Path $PSModuleLoggingPath -Force
}
Set-ItemProperty -Path $PSModuleLoggingPath -Name "EnableModuleLogging" -Value 1
# Script block logging aktif et
$PSScriptBlockPath = "HKLM:\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging"
if (!(Test-Path $PSScriptBlockPath)) {
New-Item -Path $PSScriptBlockPath -Force
}
Set-ItemProperty -Path $PSScriptBlockPath -Name "EnableScriptBlockLogging" -Value 1
B. PowerShell v2.0 Kaldırma
# PowerShell v2.0 feature'ını kaldır (güvenlik açıkları nedeniyle)
Disable-WindowsOptionalFeature -Online -FeatureName "MicrosoftWindowsPowerShellV2Root" -All
# ISE kaldırma (sunucu ortamında gerekli değil)
Disable-WindowsOptionalFeature -Online -FeatureName "MicrosoftWindowsPowerShellISE" -All
Write-Host "PowerShell v2.0 and ISE removed for security!"
C. PowerShell Constrained Language Mode
# Constrained Language Mode ayarlama (yüksek güvenlik ortamları için)
$env:__PSLockdownPolicy = "4"
# Sistem çapında constrained mode için
[Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "4", "Machine")
Write-Host "PowerShell Constrained Language Mode enabled!"
D. PowerShell Güvenlik Monitoring
function Test-PowerShellSecurity {
Write-Host "PowerShell Security Assessment:" -ForegroundColor Cyan
Write-Host "================================" -ForegroundColor Cyan
# Execution Policy kontrol
$policy = Get-ExecutionPolicy
$policyColor = switch ($policy) {
"Restricted" { "Green" }
"RemoteSigned" { "Yellow" }
"AllSigned" { "Green" }
default { "Red" }
}
Write-Host "Execution Policy: $policy" -ForegroundColor $policyColor
# PowerShell v2.0 kontrol
$ps2Feature = Get-WindowsOptionalFeature -Online -FeatureName "MicrosoftWindowsPowerShellV2Root"
$ps2Status = if ($ps2Feature.State -eq "Disabled") { "SECURE" } else { "RISK" }
$ps2Color = if ($ps2Status -eq "SECURE") { "Green" } else { "Red" }
Write-Host "PowerShell v2.0 Status: $ps2Status" -ForegroundColor $ps2Color
# Module logging kontrol
$moduleLogging = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging" -Name "EnableModuleLogging" -ErrorAction SilentlyContinue
$moduleStatus = if ($moduleLogging.EnableModuleLogging -eq 1) { "ENABLED" } else { "DISABLED" }
$moduleColor = if ($moduleStatus -eq "ENABLED") { "Green" } else { "Yellow" }
Write-Host "Module Logging: $moduleStatus" -ForegroundColor $moduleColor
# Script block logging kontrol
$scriptLogging = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" -Name "EnableScriptBlockLogging" -ErrorAction SilentlyContinue
$scriptStatus = if ($scriptLogging.EnableScriptBlockLogging -eq 1) { "ENABLED" } else { "DISABLED" }
$scriptColor = if ($scriptStatus -eq "ENABLED") { "Green" } else { "Yellow" }
Write-Host "Script Block Logging: $scriptStatus" -ForegroundColor $scriptColor
}
Test-PowerShellSecurity
Tüm Değişiklikleri Uygulayan Master Script
# Windows Server Security Hardening Master Script
param(
[switch]$SkipReboot,
[string]$NewAdminName = "SystemManager",
[int]$NewRDPPort = 6689,
[string]$NTPServers = "time.windows.com,time.nist.gov,pool.ntp.org"
)
Write-Host "Starting Windows Server Security Hardening..." -ForegroundColor Green
Write-Host "=============================================" -ForegroundColor Green
# 1. Administrator Hesabını Yeniden Adlandır
try {
Rename-LocalUser -Name "Administrator" -NewName $NewAdminName
Write-Host "[✓] Administrator account renamed to: $NewAdminName" -ForegroundColor Green
} catch {
Write-Host "[✗] Failed to rename Administrator account: $($_.Exception.Message)" -ForegroundColor Red
}
# 2. UAC Konfigürasyonu
try {
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "ConsentPromptBehaviorAdmin" -Value 2
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name "FilterAdministratorToken" -Value 1
Write-Host "[✓] UAC configured for maximum security" -ForegroundColor Green
} catch {
Write-Host "[✗] Failed to configure UAC: $($_.Exception.Message)" -ForegroundColor Red
}
# 3. Windows Firewall Sertleştirme
try {
Set-NetFirewallProfile -Profile Domain,Public,Private -DefaultInboundAction Block
Set-NetFirewallProfile -Profile Domain,Public,Private -LogAllowed True -LogBlocked True
Write-Host "[✓] Windows Firewall hardened" -ForegroundColor Green
} catch {
Write-Host "[✗] Failed to configure Firewall: $($_.Exception.Message)" -ForegroundColor Red
}
# 4. Otomatik Update Konfigürasyonu
try {
Set-Service -Name wuauserv -StartupType Automatic
Start-Service wuauserv
Write-Host "[✓] Automatic updates enabled" -ForegroundColor Green
} catch {
Write-Host "[✗] Failed to configure updates: $($_.Exception.Message)" -ForegroundColor Red
}
# 5. Gereksiz Servisleri Devre Dışı Bırak
$ServicesToDisable = @("Spooler", "RemoteRegistry", "Fax", "TrkWks")
foreach ($service in $ServicesToDisable) {
try {
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
Write-Host "[✓] Disabled service: $service" -ForegroundColor Green
} catch {
Write-Host "[!] Service $service not found or already disabled" -ForegroundColor Yellow
}
}
# 6. NTP Konfigürasyonu
try {
Stop-Service w32time
w32tm /config /manualpeerlist:$NTPServers /syncfromflags:manual /reliable:yes /update
Start-Service w32time
w32tm /resync /force
Write-Host "[✓] NTP configured with servers: $NTPServers" -ForegroundColor Green
} catch {
Write-Host "[✗] Failed to configure NTP: $($_.Exception.Message)" -ForegroundColor Red
}