<# .SYNOPSIS Bölüm 01 · Adım 1.3 — Windows LAPS Şema Genişletme, OU Yetkilendirme ve Şifreli GPO .DESCRIPTION Yerleşik Windows LAPS şemasını AD ormanına işler, OU=Servers ve OU=Workstations bilgisayarlarına kendi parolalarını şifreli güncelleme yetkisi verir ve ADPasswordEncryptionEnabled=1 GPO'sunu bağlar. .EXAMPLE powershell -ExecutionPolicy Bypass -File "D:\Lab\Scripts\03-Setup-Windows-LAPS.ps1" #> #Requires -RunAsAdministrator param( [string]$GpoName = "Sec-Windows-LAPS-Policy" ) $ErrorActionPreference = "Stop" Import-Module ActiveDirectory, LAPS, GroupPolicy $BaseDN = (Get-ADDomain).DistinguishedName $TargetOUs = @("OU=Servers,$BaseDN", "OU=Workstations,$BaseDN") Write-Host "[1/3] Windows LAPS AD şeması güncelleniyor..." -ForegroundColor Cyan Update-LapsADSchema -Confirm:$false Write-Host "[2/3] OU=Servers ve OU=Workstations bilgisayarlarına self-permission veriliyor..." -ForegroundColor Cyan foreach ($ou in $TargetOUs) { Set-LapsADComputerSelfPermission -Identity $ou | Out-Null } Write-Host "[3/3] Şifreli LAPS GPO ($GpoName) yapılandırılıyor ve bağlanıyor..." -ForegroundColor Cyan $RegKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS" if (-not (Get-GPO -Name $GpoName -ErrorAction SilentlyContinue)) { New-GPO -Name $GpoName | Out-Null } Set-GPRegistryValue -Name $GpoName -Key $RegKey -ValueName "BackupDirectory" -Type DWord -Value 2 | Out-Null Set-GPRegistryValue -Name $GpoName -Key $RegKey -ValueName "PasswordLength" -Type DWord -Value 16 | Out-Null Set-GPRegistryValue -Name $GpoName -Key $RegKey -ValueName "PasswordAgeDays" -Type DWord -Value 30 | Out-Null Set-GPRegistryValue -Name $GpoName -Key $RegKey -ValueName "PasswordComplexity" -Type DWord -Value 4 | Out-Null Set-GPRegistryValue -Name $GpoName -Key $RegKey -ValueName "ADPasswordEncryptionEnabled" -Type DWord -Value 1 | Out-Null foreach ($ou in $TargetOUs) { try { New-GPLink -Name $GpoName -Target $ou -LinkEnabled Yes | Out-Null } catch {} } Get-GPO -Name $GpoName | Select-Object DisplayName, GpoStatus, ModificationTime | Format-Table -AutoSize