
KOD İÇERİK :
Kod: Tümünü seç
# windows_ozellik.ps1
# Windows isteğe bağlı özelliklerini listeler, etkinleştirir veya devre dışı bırakır.
# Kullanım: Sağ tıkla > "PowerShell ile Çalıştır"
#Requires -Version 5.1
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
# --- Yönetici hakkı kontrolü ve otomatik yükseltme ---
function YoneticiHakkiKontrol {
$mevcutKullanici = [Security.Principal.WindowsIdentity]::GetCurrent()
$yetkiKontrol = New-Object Security.Principal.WindowsPrincipal($mevcutKullanici)
if (-not $yetkiKontrol.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Yönetici yetkisi gerekiyor, yeniden başlatılıyor..." -ForegroundColor Yellow
Start-Process -FilePath "powershell.exe" `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
}
# --- Tüm özellikleri listele ---
function OzellikleriListele {
Write-Host "`n--- Windows Özellikleri Listesi ---`n" -ForegroundColor Cyan
$ozellikler = Get-WindowsOptionalFeature -Online | Sort-Object FeatureName
$ozellikler | Format-Table `
@{Label="Özellik Adı"; Expression={$_.FeatureName}; Width=55},
@{Label="Durum"; Expression={
if ($_.State -eq "Enabled") {
"Etkin "
} else {
"Devre Dışı"
}
}; Width=12} -AutoSize
Write-Host "Toplam özellik sayısı: $($ozellikler.Count)" -ForegroundColor Gray
}
# --- Belirli bir özellik hakkında detay ---
function OzellikDetay {
$ozellikAdi = Read-Host "`nÖzellik adını girin (örnek: NetFx3)"
if ([string]::IsNullOrWhiteSpace($ozellikAdi)) {
Write-Host "Özellik adı boş bırakılamaz." -ForegroundColor Red
return
}
try {
$detay = Get-WindowsOptionalFeature -Online -FeatureName $ozellikAdi
Write-Host "`n--- Özellik Detayı ---" -ForegroundColor Cyan
Write-Host "Ad : $($detay.FeatureName)"
Write-Host "Durum : $(if ($detay.State -eq 'Enabled') { 'Etkin' } else { 'Devre Dışı' })"
Write-Host "Açıklama : $($detay.Description)"
Write-Host "Yeniden Başlatma Gerekli: $($detay.RestartNeeded)"
} catch {
Write-Host "Özellik bulunamadı: $ozellikAdi" -ForegroundColor Red
}
}
# --- Özellik etkinleştir ---
function OzellikEtkinlestir {
$ozellikAdi = Read-Host "`nEtkinleştirilecek özellik adını girin (örnek: NetFx3)"
if ([string]::IsNullOrWhiteSpace($ozellikAdi)) {
Write-Host "Özellik adı boş bırakılamaz." -ForegroundColor Red
return
}
try {
Write-Host "`n'$ozellikAdi' etkinleştiriliyor, lütfen bekleyin..." -ForegroundColor Yellow
$sonuc = Enable-WindowsOptionalFeature -Online -FeatureName $ozellikAdi -All -NoRestart
Write-Host "'$ozellikAdi' başarıyla etkinleştirildi." -ForegroundColor Green
if ($sonuc.RestartNeeded) {
Write-Host "Değişikliklerin geçerli olması için sistemi yeniden başlatmanız gerekiyor." -ForegroundColor Yellow
}
} catch {
Write-Host "Hata oluştu: $_" -ForegroundColor Red
}
}
# --- Özellik devre dışı bırak ---
function OzellikDevreDisi {
$ozellikAdi = Read-Host "`nDevre dışı bırakılacak özellik adını girin (örnek: NetFx3)"
if ([string]::IsNullOrWhiteSpace($ozellikAdi)) {
Write-Host "Özellik adı boş bırakılamaz." -ForegroundColor Red
return
}
try {
Write-Host "`n'$ozellikAdi' devre dışı bırakılıyor, lütfen bekleyin..." -ForegroundColor Yellow
$sonuc = Disable-WindowsOptionalFeature -Online -FeatureName $ozellikAdi -NoRestart
Write-Host "'$ozellikAdi' başarıyla devre dışı bırakıldı." -ForegroundColor Green
if ($sonuc.RestartNeeded) {
Write-Host "Değişikliklerin geçerli olması için sistemi yeniden başlatmanız gerekiyor." -ForegroundColor Yellow
}
} catch {
Write-Host "Hata oluştu: $_" -ForegroundColor Red
}
}
# --- Harici kaynaktan özellik kur (.NET vb.) ---
function HariciKaynaktanKur {
$ozellikAdi = Read-Host "`nKurulacak özellik adını girin (örnek: NetFx3)"
$kaynakYol = Read-Host "Kaynak dizin yolunu girin (örnek: E:\sources\sxs)"
if ([string]::IsNullOrWhiteSpace($ozellikAdi) -or [string]::IsNullOrWhiteSpace($kaynakYol)) {
Write-Host "Özellik adı ve kaynak yol boş bırakılamaz." -ForegroundColor Red
return
}
if (-not (Test-Path $kaynakYol)) {
Write-Host "Kaynak dizin bulunamadı: $kaynakYol" -ForegroundColor Red
return
}
try {
Write-Host "`n'$ozellikAdi' harici kaynaktan kuruluyor..." -ForegroundColor Yellow
Enable-WindowsOptionalFeature -Online -FeatureName $ozellikAdi -Source $kaynakYol -All -NoRestart
Write-Host "Kurulum tamamlandı." -ForegroundColor Green
} catch {
Write-Host "Hata oluştu: $_" -ForegroundColor Red
}
}
# --- Etkin özellikleri filtrele ---
function EtkinleriListele {
Write-Host "`n--- Yalnızca Etkin Özellikler ---`n" -ForegroundColor Green
Get-WindowsOptionalFeature -Online |
Where-Object { $_.State -eq "Enabled" } |
Sort-Object FeatureName |
Format-Table @{Label="Özellik Adı"; Expression={$_.FeatureName}; Width=55} -AutoSize
}
# --- Devre dışı özellikleri filtrele ---
function DevreDisilarıListele {
Write-Host "`n--- Yalnızca Devre Dışı Özellikler ---`n" -ForegroundColor DarkYellow
Get-WindowsOptionalFeature -Online |
Where-Object { $_.State -eq "Disabled" } |
Sort-Object FeatureName |
Format-Table @{Label="Özellik Adı"; Expression={$_.FeatureName}; Width=55} -AutoSize
}
# --- Ana menü ---
function AnaMenu {
while ($true) {
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host " Windows Özellik Yöneticisi" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " 1. Tüm özellikleri listele"
Write-Host " 2. Yalnızca etkin özellikleri listele"
Write-Host " 3. Yalnızca devre dışı özellikleri listele"
Write-Host " 4. Özellik detayı gör"
Write-Host " 5. Özellik etkinleştir"
Write-Host " 6. Özellik devre dışı bırak"
Write-Host " 7. Harici kaynaktan özellik kur"
Write-Host " 0. Çıkış"
Write-Host "========================================" -ForegroundColor Cyan
$secim = Read-Host "`nSeçiminiz"
switch ($secim) {
"1" { OzellikleriListele }
"2" { EtkinleriListele }
"3" { DevreDisilarıListele }
"4" { OzellikDetay }
"5" { OzellikEtkinlestir }
"6" { OzellikDevreDisi }
"7" { HariciKaynaktanKur }
"0" { Write-Host "Çıkılıyor..." -ForegroundColor Gray; exit }
default { Write-Host "Geçersiz seçim, tekrar deneyin." -ForegroundColor Red }
}
Write-Host "`nDevam etmek için bir tuşa basın..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
}
# ============================================================
# BAŞLANGIÇ
# ============================================================
YoneticiHakkiKontrol
AnaMenu*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
BETİK - 2 : sistem_koruma.ps1

Kod: Tümünü seç
# sistem_koruma.ps1
# Windows 10/11 Sistem Korumasını açar, kapatır ve durumunu analiz eder.
# Kullanım: Sağ tıkla > "PowerShell ile Çalıştır"
#Requires -Version 5.1
Set-StrictMode -Version Latest
$ErrorActionPreference = "SilentlyContinue"
# --- Yönetici hakkı kontrolü ve otomatik yükseltme ---
function YoneticiHakkiKontrol {
$mevcutKullanici = [Security.Principal.WindowsIdentity]::GetCurrent()
$yetkiKontrol = New-Object Security.Principal.WindowsPrincipal($mevcutKullanici)
if (-not $yetkiKontrol.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Yönetici yetkisi gerekiyor, yeniden başlatılıyor..." -ForegroundColor Yellow
Start-Process -FilePath "powershell.exe" `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
}
# --- Tüm sürücülerin durumunu analiz et ---
function DurumAnaliz {
Write-Host "`n--- Sistem Koruma Durumu Analizi ---`n" -ForegroundColor Cyan
$suruculer = Get-WmiObject -Namespace "root\default" `
-Class "SystemRestore" `
-ErrorAction SilentlyContinue
# Kayıt defterinden koruma durumunu oku
$korumaDurumu = @{}
$regYolu = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients"
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
$harf = "$($_.Root.TrimEnd('\'))"
$regAnahtar = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
# vssadmin ile koruma durumu
$vss????? = & vssadmin list shadowstorage /for=$harf 2>&1
$korumaDurumu[$harf] = $vssCikti
}
# Gerçek koruma durumu ComputerRestoreStatus üzerinden
$surucuListesi = Get-WmiObject -Namespace "root\default" `
-Query "SELECT * FROM SystemRestoreConfig" `
-ErrorAction SilentlyContinue
Write-Host " Sürücü Durum Geri Yükleme Noktası Sayısı" -ForegroundColor White
Write-Host " -------- ------------------ ----------------------------" -ForegroundColor Gray
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
$harf = $_.Root.TrimEnd('\')
$harfUz = "$harf\"
# Koruma durumu: Enable-ComputerRestore çalışıyorsa etkin
$durum = "Bilinmiyor"
$renk = "Gray"
try {
$srKonfig = Get-ItemProperty `
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" `
-ErrorAction Stop
$devreDisi = (Get-ItemProperty `
"HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" `
-ErrorAction SilentlyContinue)
# VSS gölge depolaması var mı kontrol et
$vssCikti = & vssadmin list shadowstorage 2>&1 | Out-String
if ($vssCikti -match [regex]::Escape($harf)) {
$durum = "Etkin "
$renk = "Green"
} else {
$durum = "Devre Dışı"
$renk = "Red"
}
} catch {
$durum = "Okunamadı "
$renk = "Yellow"
}
# Geri yükleme noktası sayısı
$noktaSayisi = 0
try {
$noktalar = Get-ComputerRestorePoint -ErrorAction SilentlyContinue
if ($noktalar) {
$noktaSayisi = ($noktalar | Where-Object {
$_.Description -notlike "*" -or $true
}).Count
}
} catch {}
Write-Host -NoNewline " $($harf.PadRight(9))"
Write-Host -NoNewline "$durum" -ForegroundColor $renk
Write-Host " $noktaSayisi adet"
}
# Sistem C: sürücüsü için detaylı bilgi
Write-Host "`n--- C:\ Sürücüsü Detayı ---`n" -ForegroundColor Cyan
try {
$noktalar = Get-ComputerRestorePoint -ErrorAction Stop
if ($noktalar -and $noktalar.Count -gt 0) {
$noktalar | Sort-Object CreationTime -Descending |
Select-Object -First 5 |
Format-Table `
@{Label="Açıklama"; Expression={$_.Description}; Width=40},
@{Label="Tür"; Expression={$_.RestorePointType}; Width=20},
@{Label="Oluşturulma"; Expression={
[Management.ManagementDateTimeConverter]::ToDateTime($_.CreationTime)
}; Width=22} -AutoSize
Write-Host " (Son 5 geri yükleme noktası gösteriliyor)" -ForegroundColor Gray
} else {
Write-Host " Geri yükleme noktası bulunamadı." -ForegroundColor Yellow
}
} catch {
Write-Host " Geri yükleme noktaları okunamadı." -ForegroundColor Yellow
}
# VSS depolama detayı
Write-Host "`n--- VSS Gölge Depolama Bilgisi ---`n" -ForegroundColor Cyan
& vssadmin list shadowstorage 2>&1 | ForEach-Object {
if ($_ -match "Hata|Error") {
Write-Host " $_" -ForegroundColor Red
} elseif ($_ -match "Boyut|Size|Kullanılan|Used") {
Write-Host " $_" -ForegroundColor White
} else {
Write-Host " $_" -ForegroundColor Gray
}
}
}
# --- Sistem korumasını etkinleştir ---
function KorumayiEtkinlestir {
Write-Host "`nHangi sürücü için etkinleştirilsin?" -ForegroundColor Yellow
$suruculer = Get-PSDrive -PSProvider FileSystem |
Select-Object -ExpandProperty Root |
ForEach-Object { $_.TrimEnd('\') }
for ($i = 0; $i -lt $suruculer.Count; $i++) {
Write-Host " $($i + 1). $($suruculer[$i])"
}
Write-Host " A. Tüm sürücüler"
$secim = Read-Host "`nSeçiminiz"
$hedefler = @()
if ($secim -match "^[Aa]$") {
$hedefler = $suruculer
} elseif ($secim -match "^\d+$" -and [int]$secim -ge 1 -and [int]$secim -le $suruculer.Count) {
$hedefler = @($suruculer[[int]$secim - 1])
} else {
Write-Host "Geçersiz seçim." -ForegroundColor Red
return
}
foreach ($surucu in $hedefler) {
Write-Host "`n'$surucu' için sistem koruması etkinleştiriliyor..." -ForegroundColor Yellow
try {
Enable-ComputerRestore -Drive "$surucu\" -ErrorAction Stop
Write-Host "'$surucu' için sistem koruması etkinleştirildi." -ForegroundColor Green
} catch {
Write-Host "'$surucu' için etkinleştirme başarısız: $_" -ForegroundColor Red
}
}
}
# --- Sistem korumasını devre dışı bırak ---
function KorumayiDevreDisi {
Write-Host "`nHangi sürücü için devre dışı bırakılsın?" -ForegroundColor Yellow
$suruculer = Get-PSDrive -PSProvider FileSystem |
Select-Object -ExpandProperty Root |
ForEach-Object { $_.TrimEnd('\') }
for ($i = 0; $i -lt $suruculer.Count; $i++) {
Write-Host " $($i + 1). $($suruculer[$i])"
}
Write-Host " A. Tüm sürücüler"
$secim = Read-Host "`nSeçiminiz"
$hedefler = @()
if ($secim -match "^[Aa]$") {
$hedefler = $suruculer
} elseif ($secim -match "^\d+$" -and [int]$secim -ge 1 -and [int]$secim -le $suruculer.Count) {
$hedefler = @($suruculer[[int]$secim - 1])
} else {
Write-Host "Geçersiz seçim." -ForegroundColor Red
return
}
# Uyarı
Write-Host "`nUYARI: Sistem koruması devre dışı bırakılırsa mevcut geri" -ForegroundColor Red
Write-Host "yükleme noktaları SİLİNECEKTİR. Devam etmek istiyor musunuz?" -ForegroundColor Red
$onay = Read-Host "(E/H)"
if ($onay -notmatch "^[Ee]$") {
Write-Host "İşlem iptal edildi." -ForegroundColor Gray
return
}
foreach ($surucu in $hedefler) {
Write-Host "`n'$surucu' için sistem koruması devre dışı bırakılıyor..." -ForegroundColor Yellow
try {
Disable-ComputerRestore -Drive "$surucu\" -ErrorAction Stop
Write-Host "'$surucu' için sistem koruması devre dışı bırakıldı." -ForegroundColor Green
} catch {
Write-Host "'$surucu' için devre dışı bırakma başarısız: $_" -ForegroundColor Red
}
}
}
# --- Manuel geri yükleme noktası oluştur ---
function GeriYuklemeNoktasiOlustur {
$aciklama = Read-Host "`nGeri yükleme noktası açıklaması girin"
if ([string]::IsNullOrWhiteSpace($aciklama)) {
$aciklama = "Manuel - $(Get-Date -Format 'dd.MM.yyyy HH:mm')"
}
Write-Host "`nGeri yükleme noktası oluşturuluyor..." -ForegroundColor Yellow
try {
Checkpoint-Computer -Description $aciklama `
-RestorePointType "MODIFY_SETTINGS" `
-ErrorAction Stop
Write-Host "Geri yükleme noktası başarıyla oluşturuldu: '$aciklama'" -ForegroundColor Green
} catch {
Write-Host "Geri yükleme noktası oluşturulamadı: $_" -ForegroundColor Red
Write-Host "C:\ için sistem koruması etkin olmayabilir." -ForegroundColor Yellow
}
}
# --- Ana menü ---
function AnaMenu {
while ($true) {
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host " Sistem Koruma Yöneticisi" -ForegroundColor Cyan
Write-Host " Windows 10 / 11" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " 1. Durum analizi"
Write-Host " 2. Sistem korumasını etkinleştir"
Write-Host " 3. Sistem korumasını devre dışı bırak"
Write-Host " 4. Manuel geri yükleme noktası oluştur"
Write-Host " 0. Çıkış"
Write-Host "========================================" -ForegroundColor Cyan
$secim = Read-Host "`nSeçiminiz"
switch ($secim) {
"1" { DurumAnaliz }
"2" { KorumayiEtkinlestir }
"3" { KorumayiDevreDisi }
"4" { GeriYuklemeNoktasiOlustur }
"0" { Write-Host "Çıkılıyor..." -ForegroundColor Gray; exit }
default { Write-Host "Geçersiz seçim, tekrar deneyin." -ForegroundColor Red }
}
Write-Host "`nDevam etmek için bir tuşa basın..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
}
# ============================================================
# BAŞLANGIÇ
# ============================================================
YoneticiHakkiKontrol
AnaMenu*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
BETİK - 3 : netfx35_kur.ps1

Kod: Tümünü seç
# netfx35_kur.ps1
# .NET Framework 3.5'i Windows 10/11 üzerinde etkinleştirir.
# Yöntem 1 : Windows Update üzerinden (internet bağlantısı gerekir)
# Yöntem 2 : Harici kaynak (ISO veya USB) üzerinden
# Kullanım : Sağ tıkla > "PowerShell ile Çalıştır"
#Requires -Version 5.1
Set-StrictMode -Version Latest
$ErrorActionPreference = "SilentlyContinue"
# --- Yönetici hakkı kontrolü ve otomatik yükseltme ---
function YoneticiHakkiKontrol {
$mevcutKullanici = [Security.Principal.WindowsIdentity]::GetCurrent()
$yetkiKontrol = New-Object Security.Principal.WindowsPrincipal($mevcutKullanici)
if (-not $yetkiKontrol.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "Yönetici yetkisi gerekiyor, yeniden başlatılıyor..." -ForegroundColor Yellow
Start-Process -FilePath "powershell.exe" `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
}
# --- .NET Framework 3.5 kurulu mu kontrol et ---
function NetFxDurumKontrol {
$durum = Get-WindowsOptionalFeature -Online -FeatureName "NetFx3"
return $durum.State
}
# --- İlerleme çubuğu göster ---
function IlerlemeGoster {
param([string]$Mesaj, [int]$Yuzde)
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" `
-Status $Mesaj `
-PercentComplete $Yuzde
}
# --- Yöntem 1: Windows Update üzerinden kur ---
function WindowsUpdateIleKur {
Write-Host "`nWindows Update üzerinden kurulum başlatılıyor..." -ForegroundColor Yellow
Write-Host "İnternet bağlantısı gereklidir, lütfen bekleyin...`n" -ForegroundColor Gray
IlerlemeGoster -Mesaj "Paket indiriliyor ve kuruluyor..." -Yuzde 10
try {
$sonuc = Enable-WindowsOptionalFeature `
-Online `
-FeatureName "NetFx3" `
-All `
-NoRestart `
-ErrorAction Stop
IlerlemeGoster -Mesaj "Tamamlandı." -Yuzde 100
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
Write-Host ".NET Framework 3.5 başarıyla etkinleştirildi." -ForegroundColor Green
if ($sonuc.RestartNeeded) {
Write-Host "Değişikliklerin geçerli olması için sistemi yeniden başlatmanız gerekiyor." -ForegroundColor Yellow
$yanit = Read-Host "Şimdi yeniden başlatılsın mı? (E/H)"
if ($yanit -match "^[Ee]$") {
Restart-Computer -Force
}
}
} catch {
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
Write-Host "`nHata oluştu: $_" -ForegroundColor Red
Write-Host "Windows Update erişimi başarısız olabilir." -ForegroundColor Red
Write-Host "Harici kaynak yöntemini deneyin (seçenek 2)." -ForegroundColor Yellow
}
}
# --- Yöntem 2: Harici kaynak üzerinden kur (ISO/USB) ---
function HariciKaynaktanKur {
Write-Host "`nHarici kaynak yöntemi seçildi." -ForegroundColor Yellow
Write-Host "Windows 10/11 ISO dosyasının bağlı olması veya kurulum USB'sinin takılı olması gerekir.`n" -ForegroundColor Gray
# Kaynak dizin otomatik arama
$olasiYollar = @()
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
$aday = "$($_.Root)sources\sxs"
if (Test-Path $aday) {
$olasiYollar += $aday
}
}
if ($olasiYollar.Count -gt 0) {
Write-Host "Olası kaynak dizin(ler) bulundu:" -ForegroundColor Cyan
for ($i = 0; $i -lt $olasiYollar.Count; $i++) {
Write-Host " $($i + 1). $($olasiYollar[$i])"
}
Write-Host " M. Manuel giriş"
$secim = Read-Host "`nSeçiminiz"
if ($secim -match "^\d+$" -and [int]$secim -ge 1 -and [int]$secim -le $olasiYollar.Count) {
$kaynakYol = $olasiYollar[[int]$secim - 1]
} else {
$kaynakYol = Read-Host "Kaynak dizin yolunu girin (örnek: D:\sources\sxs)"
}
} else {
Write-Host "Otomatik kaynak dizin bulunamadı." -ForegroundColor DarkYellow
$kaynakYol = Read-Host "Kaynak dizin yolunu manuel girin (örnek: D:\sources\sxs)"
}
# Yol doğrulama
if ([string]::IsNullOrWhiteSpace($kaynakYol)) {
Write-Host "Kaynak yol boş bırakılamaz." -ForegroundColor Red
return
}
if (-not (Test-Path $kaynakYol)) {
Write-Host "Kaynak dizin bulunamadı: $kaynakYol" -ForegroundColor Red
return
}
# Kaynak içinde gerekli dosyayı ara
$netfxDosya = Join-Path $kaynakYol "microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab"
if (-not (Test-Path $netfxDosya)) {
Write-Host "Kaynak dizinde .NET Framework 3.5 paketi bulunamadı." -ForegroundColor Red
Write-Host "Dizin geçerli bir Windows kurulum kaynağı olmayabilir." -ForegroundColor Red
return
}
Write-Host "`nKaynak doğrulandı: $kaynakYol" -ForegroundColor Green
Write-Host "Kurulum başlatılıyor, lütfen bekleyin...`n" -ForegroundColor Yellow
IlerlemeGoster -Mesaj "Harici kaynaktan kuruluyor..." -Yuzde 10
try {
$sonuc = Enable-WindowsOptionalFeature `
-Online `
-FeatureName "NetFx3" `
-Source $kaynakYol `
-All `
-NoRestart `
-ErrorAction Stop
IlerlemeGoster -Mesaj "Tamamlandı." -Yuzde 100
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
Write-Host ".NET Framework 3.5 başarıyla etkinleştirildi." -ForegroundColor Green
if ($sonuc.RestartNeeded) {
Write-Host "Değişikliklerin geçerli olması için sistemi yeniden başlatmanız gerekiyor." -ForegroundColor Yellow
$yanit = Read-Host "Şimdi yeniden başlatılsın mı? (E/H)"
if ($yanit -match "^[Ee]$") {
Restart-Computer -Force
}
}
} catch {
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
Write-Host "`nHata oluştu: $_" -ForegroundColor Red
}
}
# --- Yöntem 3: DISM komutu ile kur (alternatif yöntem) ---
function DismIleKur {
Write-Host "`nDISM yöntemi seçildi." -ForegroundColor Yellow
Write-Host "Bu yöntem Windows Update bağlantısını kullanır.`n" -ForegroundColor Gray
IlerlemeGoster -Mesaj "DISM üzerinden kuruluyor..." -Yuzde 10
try {
$dismCikti = & dism.exe /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /NoRestart 2>&1
IlerlemeGoster -Mesaj "DISM tamamlandı." -Yuzde 100
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
if ($LASTEXITCODE -eq 0 -or $LASTEXITCODE -eq 3010) {
Write-Host ".NET Framework 3.5 DISM ile başarıyla kuruldu." -ForegroundColor Green
if ($LASTEXITCODE -eq 3010) {
Write-Host "Değişikliklerin geçerli olması için sistemi yeniden başlatmanız gerekiyor." -ForegroundColor Yellow
$yanit = Read-Host "Şimdi yeniden başlatılsın mı? (E/H)"
if ($yanit -match "^[Ee]$") {
Restart-Computer -Force
}
}
} else {
Write-Host "DISM kurulumu başarısız oldu. Çıkış kodu: $LASTEXITCODE" -ForegroundColor Red
Write-Host "DISM çıktısı:`n$dismCikti" -ForegroundColor DarkRed
}
} catch {
Write-Progress -Activity ".NET Framework 3.5 Kurulumu" -Completed
Write-Host "Hata oluştu: $_" -ForegroundColor Red
}
}
# --- Ana menü ---
function AnaMenu {
while ($true) {
# Mevcut durum
$mevcutDurum = NetFxDurumKontrol
$durumMetin = if ($mevcutDurum -eq "Enabled") { "Etkin" } else { "Devre Disi" }
$durumRenk = if ($mevcutDurum -eq "Enabled") { "Green" } else { "Red" }
Write-Host "`n========================================" -ForegroundColor Cyan
Write-Host " .NET Framework 3.5 Kurulum Araci" -ForegroundColor Cyan
Write-Host " Windows 10 / 11" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host " Mevcut Durum: " -NoNewline
Write-Host $durumMetin -ForegroundColor $durumRenk
Write-Host "----------------------------------------" -ForegroundColor Cyan
if ($mevcutDurum -eq "Enabled") {
Write-Host " .NET Framework 3.5 zaten etkin durumda." -ForegroundColor Green
Write-Host " Ek bir islem yapmaniza gerek yok." -ForegroundColor Green
Write-Host "`n 0. Cikis"
$secim = Read-Host "`nSeciminiz"
if ($secim -eq "0") { exit }
continue
}
Write-Host " 1. Windows Update uzerinden kur (internet gerekir)"
Write-Host " 2. Harici kaynak uzerinden kur (ISO/USB)"
Write-Host " 3. DISM ile kur (alternatif)"
Write-Host " 0. Cikis"
Write-Host "========================================" -ForegroundColor Cyan
$secim = Read-Host "`nSeciminiz"
switch ($secim) {
"1" { WindowsUpdateIleKur }
"2" { HariciKaynaktanKur }
"3" { DismIleKur }
"0" { Write-Host "Cikiliyor..." -ForegroundColor Gray; exit }
default { Write-Host "Gecersiz secim, tekrar deneyin." -ForegroundColor Red }
}
Write-Host "`nDevam etmek icin bir tusa basin..."
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
}
}
# ============================================================
# BASLANGIC
# ============================================================
YoneticiHakkiKontrol
AnaMenu*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
*******************************************************************************************************************************************************************
Güle güle kullanın...!!!

