Bu örnek betiği kopyalayıp yapıştırın ve ortamınız için gerektiği gibi değiştirin:

<# . ÖZET     Güvenli Önyükleme Dağıtımı Orchestrator'ını Windows Zamanlanmış Görevi olarak dağıtır.

.DESCRIPTION     Orchestrator'ı arka planda sürekli olarak çalıştıran zamanlanmış bir görev oluşturur.Görev, atlama yürütme ilkesiyle çalıştırıldığından hiçbir güvenlik istemi görüntülenmez.     Düzenleyici aşağıdakileri yapacaktır:     - Belirtilen aralıkta cihaz güncelleştirmelerini yoklama     - Dalgaları otomatik olarak oluşturma ve GPO'ları dağıtma     - Tüm uygun cihazlar güncelleştirilene      kadar devam edin     kullanarak ilerleme durumunu izleme: Get-SecureBootRolloutStatus.ps1

.PARAMETER AggregationInputPath     JSON cihaz verilerinin UNC yolu (algılama GPO'sundan)

.PARAMETER ReportBasePath     Raporlar ve durum dosyaları için yerel yol

.PARAMETER TargetOU     GPO'ları bağlamak için OU (isteğe bağlı - varsayılan olarak etki alanı köküne)

.PARAMETER PollIntervalMinutes     Durum denetimleri arasındaki dakika. Varsayılan: 30

.PARAMETER UseWinCS     AvailableUpdatesPolicy GPO yerine WinCS (Windows Yapılandırma Sistemi) kullanın.Etkinleştirildiğinde, zamanlanmış WinCsFlags.exe görevi kayıt defteri GPO'sunun yerine uç noktalara dağıtır.

.PARAMETER WinCSKey     Güvenli Önyükleme yapılandırması için WinCS anahtarı. Varsayılan: F33E0C8E002

.PARAMETER ServiceAccount     Görevi çalıştırmak için hesap. Varsayılan: SİSTEM     Etki alanı işlemleri için bir etki alanı yöneticisi hizmet hesabı kullanın.

.PARAMETER ScriptPath     Orchestrator betiğinin yolu. Varsayılan: Bu betikle aynı klasör.

.PARAMETER Uninstall     Zamanlanmış görevi kaldırma

.EXAMPLE     .\Deploy-OrchestratorTask.ps1 -AggregationInputPath "\\server\SecureBootData$" -ReportBasePath "C:\SecureBootReports" -ServiceAccount "DOMAIN\svc_secureboot"

.EXAMPLE     .\Deploy-OrchestratorTask.ps1 -AggregationInputPath "\\server\SecureBootData$" -ReportBasePath "C:\SecureBootReports"

.EXAMPLE     # AvailableUpdatesPolicy yerine WinCS yöntemini kullanarak dağıtma     .\Deploy-OrchestratorTask.ps1 -AggregationInputPath "\\server\SecureBootData$" -ReportBasePath "C:\SecureBootReports" -UseWinCS

.EXAMPLE     .\Deploy-OrchestratorTask.ps1 -Kaldır #>

[CmdletBinding()] param(     [Parameter(Mandatory = $false)]     [string]$AggregationInputPath,     [Parameter(Zorunlu = $false)]     [string]$ReportBasePath,     [Parameter(Zorunlu = $false)]     [string]$TargetOU,     [Parameter(Zorunlu = $false)]     [int]$PollIntervalMinutes = 30,     [Parameter(Zorunlu = $false)]     [switch]$UseWinCS,     [Parameter(Zorunlu = $false)]     [string]$WinCSKey = "F33E0C8E002",     [Parameter(Zorunlu = $false)]     [string]$ServiceAccount = "SYSTEM",     [Parameter(Zorunlu = $false)]     [string]$ScriptPath,     [Parameter(Zorunlu = $false)]     [switch]$Uninstall )                                        

$ErrorActionPreference = "Stop" $TaskName = "SecureBoot-Rollout-Orchestrator" $DownloadUrl = "https://aka.ms/getsecureboot" $DownloadSubPage = "Dağıtım ve İzleme Örnekleri"

# ============================================================================ # BAĞıMLıLıK DOĞRULAMA # ============================================================================

function Test-ScriptDependencies {     <#     . ÖZET         Tüm gerekli betiklerin mevcut olduğunu doğrular.. AÇIKLAMA         Gerekli betik bağımlılıklarını denetler ve eksikse indirme yönergeleri sağlar.#>     param(         [Parameter(Zorunlu = $true)]         [string]$ScriptDirectory,                  [Parameter(Zorunlu = $true)]         [dize[]]$RequiredScripts     )          $missingScripts = @()          foreach ($RequiredScripts'da $script) {         $scriptPath = Join-Path $ScriptDirectory $script         if (-not (Test-Path $scriptPath)) {             $missingScripts += $script         }     }          if ($missingScripts.Count -gt 0) {         "" Write-Host         Write-Host ("=" * 70) -ForegroundColor Red         Write-Host " EKSİk BAĞIMLAR" -ForegroundColor Red         Write-Host ("=" * 70) -ForegroundColor Red         "" Write-Host         Write-Host "Aşağıdaki gerekli betikler bulunamadı:" -ForegroundColor Yellow         foreach ($missingScripts $script) {             Write-Host " - $script" -ForegroundColor White         }         "" Write-Host         Write-Host "Lütfen en son betikleri indirin:" -ForegroundColor Cyan         Write-Host " URL: $DownloadUrl" -ForegroundColor White         Write-Host " Git: '$DownloadSubPage'" -ForegroundColor White         "" Write-Host         Write-Host "Tüm betikleri aynı dizine ayıklayın ve yeniden çalıştırın." -ForegroundColor Yellow         "" Write-Host         return $false     }          dönüş $true }

# Required scripts for orchestrator deployment $requiredScripts = @(     "Start-SecureBootRolloutOrchestrator.ps1",     "Aggregate-SecureBootData.ps1",     "Deploy-GPO-SecureBootCollection.ps1",     "Detect-SecureBootCertUpdateStatus.ps1",     "Get-SecureBootRolloutStatus.ps1",     "Enable-SecureBootUpdateTask.ps1" )

if (-not (Test-ScriptDependencies -ScriptDirectory $PSScriptRoot -RequiredScripts $requiredScripts)) {     çıkış 1 }

# ============================================================================ # KALDıR # ============================================================================

if ($Uninstall) {     "" Write-Host     Write-Host "Zamanlanmış görev kaldırılıyor: $TaskName" -ForegroundColor Yellow     $existingTask = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue     if ($existingTask) {         Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue         Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false         Write-Host "Görev başarıyla kaldırıldı." -ForegroundColor Green     } else {         Write-Host "Görev bulunamadı." -ForegroundColor Gray     }     çıkış 0 }     

# ============================================================================ # DOĞRULAMA # ============================================================================

if (-not $AggregationInputPath -or -not $ReportBasePath) {     Write-Host "HATA: -AggregationInputPath ve -ReportBasePath gerekli." -ForegroundColor Red     "" Write-Host     Write-Host "Örnek:" -ForegroundColor Yellow     Write-Host ' .\Deploy-OrchestratorTask.ps1 -AggregationInputPath "\\server\SecureBootData$" -ReportBasePath "C:\SecureBootReports"'     çıkış 1 }

# Find orchestrator script if (-not $ScriptPath) {     $ScriptPath = Join-Path $PSScriptRoot "Start-SecureBootRolloutOrchestrator.ps1" }

if (-not (Test-Path $ScriptPath)) {     Write-Host "HATA: Orchestrator betiği bulunamadı: $ScriptPath" -ForegroundColor Red     çıkış 1 }

# Find aggregation script (needed by orchestrator) $aggregateScript = Join-Path $PSScriptRoot "Aggregate-SecureBootData.ps1" if (-not (Test-Path $aggregateScript)) {     Write-Host "UYARI: Aggregate-SecureBootData.ps1 betik dizininde bulunamadı" -ForegroundColor Yellow     Write-Host " Orchestrator bu betiği bulamazsa başarısız olabilir." -ForegroundColor Yellow }

Write-Host "" Write-Host ("=" * 70) -ForegroundColor Cyan Write-Host " Güvenli Önyükleme Dağıtımı Orchestrator - Görev Dağıtımı" -ForegroundColor Cyan Write-Host ("=" * 70) -ForegroundColor Cyan "" Write-Host

# For display, show relative paths (script names only) $displayScriptPath = Split-Path $ScriptPath -Leaf

Write-Host "Configuration:" -ForegroundColor Yellow Write-Host " Görev Adı: $TaskName" Write-Host " Orchestrator: $displayScriptPath" Write-Host " Giriş Yolu: $AggregationInputPath" "Rapor Yolu: $ReportBasePath" Write-Host Write-Host " Hedef OU: $(if ($TargetOU) { $TargetOU } else { '(etki alanı kökü)' })" Write-Host " Yoklama Aralığı: $PollIntervalMinutes dakika" Write-Host " Hizmet Hesabı: $ServiceAccount" Write-Host " Dağıtım Yöntemi: $(if ($UseWinCS) { "WinCS (WinCsFlags.exe)" } else { "AvailableUpdatesPolicy (GPO)" })" if ($UseWinCS) {     Write-Host " WinCS Anahtarı: $WinCSKey" } Write-Host ""

# ============================================================================ # GPO ALGıLAMA - EKSIKSE OTOMATIK DAĞıTMA # ============================================================================

$CollectionGPOName = "SecureBoot-EventCollection" $deployGpoScript = Join-Path $PSScriptRoot "Deploy-GPO-SecureBootCollection.ps1"

# Check if GroupPolicy module is available if (Get-Module -ListAvailable -Name GroupPolicy) {     Import-Module GroupPolicy -ErrorAction SilentlyContinue     Write-Host "Algılama GPO'su denetleniyor..." -ForegroundColor Yellow     try {         # AggregationInputPath'ten etki alanını alın (ör. \\domain\share)         $domainFromPath = if ($AggregationInputPath -match '^\\\\([^\\]+)\\') {             $matches[1]         } else {             $env:USERDNSDOMAIN         }         # GPO olup olmadığını denetleyin         $existingGpo = Get-GPO -Name $CollectionGPOName -ErrorAction SilentlyContinue         if ($existingGpo) {             Write-Host " Algılama GPO'su bulundu: $CollectionGPOName" -ForegroundColor Green         } else {             "" Write-Host             Write-Host ("=" * 70) -ForegroundColor Yellow             Write-Host " ALGıLAMA GPO'SU BULUNAMADı" -ForegroundColor Sarı             Write-Host ("=" * 70) -ForegroundColor Yellow             "" Write-Host             Write-Host "Algılama GPO '$CollectionGPOName' bulunamadı." -ForegroundColor Yellow             Write-Host "Cihaz durumu verilerini toplamak için bu GPO gereklidir." -ForegroundColor Yellow             "" Write-Host             # Kullanıcıya GPO'ya şimdi dağıtmak isteyip istemediğini sorun             Write-Host "Algılama GPO'sunu şimdi dağıtmak istiyor musunuz?                                          (Y/N)" -ForegroundColor Cyan             $response = Okuma Konağı                          if ($response -match '^[Yy]') {                 Write-Host ""                 Write-Host "GPO Dağıtımı Başlatıyor..." -ForegroundColor Cyan                 ""                  Write-Host                 # GPO dağıtımı için derleme parametreleri                 $gpoParams = @{                     DomainName = $domainFromPath                     CollectionSharePath = $AggregationInputPath                     ScriptSourcePath = Join-Path $PSScriptRoot "Detect-SecureBootCertUpdateStatus.ps1"                 }                                  if ($TargetOU) {                     $gpoParams.OUPath = $TargetOU                 } else {                     # Kullanıcının seçmesine izin vermek için AutoDetectOU'yu kullanın                     $gpoParams.AutoDetectOU = $true                 }                                  # GPO dağıtım betiğini çalıştırma                                 & $deployGpoScript @gpoParams                 if ($LASTEXITCODE -ne 0) {                     Write-Host "GPO dağıtımı sorunlarla karşılaşmış olabilir. Yukarıdaki çıkışı gözden geçirin." -ForegroundColor Yellow                     Write-Host "Orchestrator dağıtımına devam edebilir veya durdurmak için Ctrl+C tuşlarına basabilirsiniz." -ForegroundColor Yellow                     "" Write-Host                     "Devam etmek için Enter tuşuna basın" Read-Host                 } else {                     "" Write-Host                     Write-Host "Algılama GPO'su başarıyla dağıtıldı!" -ForegroundColor Green                     "" Write-Host                 }             } else {                 "" Write-Host                 Write-Host "GPO dağıtımı atlanıyor. Düzenleyici cihaz verilerini almayacak" -ForegroundColor Yellow                 Write-Host "Algılama GPO'sunun el ile dağıtılacağı zamana kadar." -ForegroundColor Yellow                 "" Write-Host                 Write-Host "Algılama GPO'sunu daha sonra dağıtmak için şunu çalıştırın:" -ForegroundColor Cyan                 Write-Host " .\Deploy-GPO-SecureBootCollection.ps1 -DomainName '"$domainFromPath'" -AutoDetectOU" -ForegroundColor White                 "" Write-Host             }         }     } catch {         Write-Host " GPO denetlenemiyor: $($_. Exception.Message)" -ForegroundColor Yellow         Write-Host " Orchestrator dağıtımıyla devam ediyor..." -ForegroundColor Gray     } } else {     Write-Host " GroupPolicy modülü kullanılamıyor - GPO denetimi atlanıyor" -ForegroundColor Gray     Write-Host " Algılama GPO's un ayrı dağıtıldığından emin olun." -ForegroundColor Gray }

Write-Host ""

# ============================================================================ # DERLEME BAĞıMSıZ DEĞIŞKENLERI # ============================================================================

$arguments = @(     "-NoProfile"     "-ExecutionPolicy Bypass"     "-File '"$ScriptPath'""     "-AggregationInputPath '"$AggregationInputPath'""     "-ReportBasePath '"$ReportBasePath'""     "-PollIntervalMinutes $PollIntervalMinutes" )

if ($TargetOU) {     $arguments += "-TargetOU '"$TargetOU'"" }

if ($UseWinCS) {     $arguments += "-UseWinCS"     $arguments += "-WinCSKey '"$WinCSKey'"" }

$argumentString = $arguments -join " "

# Don't display raw arguments with full paths - it's confusing for published scripts # Görev, tam yolu dahili olarak kullanır

# ============================================================================ # ZAMANLANMıŞ GÖREV OLUŞTUR # ============================================================================

# Check for existing task $existingTask = Get-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue if ($existingTask) {     Write-Host "Görev zaten var. Güncelleştiriliyor..." -ForegroundColor Yellow     Stop-ScheduledTask -TaskName $TaskName -ErrorAction SilentlyContinue     Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false }

# Create task action $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument $argumentString -WorkingDirectory $PSScriptRoot

# Create trigger - run once, immediately (orchestrator loops internally) $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date). AddMinutes(1)

# Create principal if ($ServiceAccount -eq "SYSTEM") {     $principal = New-ScheduledTaskPrincipal -UserId "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest } else {     # Etki alanı hesabı için parola iste     Write-Host "$ServiceAccount için parola girin" -ForegroundColor Yellow     $cred = Get-Credential -UserName $ServiceAccount -Message "Zamanlanmış görev için hizmet hesabı kimlik bilgileri"     $principal = New-ScheduledTaskPrincipal -UserId $ServiceAccount -LogonType Parolası -RunLevel Highest }

# Task settings $settings = New-ScheduledTaskSettingsSet '     -AllowStartIfOnBatteries '     -DontStopIfGoingOnBatteries '     -StartWhenAvailable '     -RunOnlyIfNetworkAvailable '     -RestartCount 3 '     -RestartInterval (New-TimeSpan -Minutes 5) '     -ExecutionTimeLimit (New-TimeSpan -Days 30) # Allow long-running

# Register task try {     if ($ServiceAccount -eq "SYSTEM") {         Register-ScheduledTask -TaskName $TaskName -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Description "Güvenli Önyükleme Sertifikası Dağıtımı - Otomatik GPO dağıtımı"     } else {         Register-ScheduledTask -TaskName $TaskName -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Description "Güvenli Önyükleme Sertifikası Dağıtımı - Otomatik GPO dağıtımı" -Kullanıcı $ServiceAccount -Parola $cred. GetNetworkCredential(). Parola     }     Write-Host "Zamanlanmış görev başarıyla oluşturuldu!" -ForegroundColor Green } catch {     Write-Host "Zamanlanmış görev oluşturulamadı: $($_. Exception.Message)" -ForegroundColor Red     çıkış 1 }

# ============================================================================ # DURUM KıSAYOLU OLUŞTUR # ============================================================================

$statusScript = Join-Path $PSScriptRoot "Get-SecureBootRolloutStatus.ps1" if (Test Yolu $statusScript) {     "" Write-Host     Write-Host "Dağıtım durumunu denetlemek için şunu çalıştırın:" -ForegroundColor Yellow     Write-Host " .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath '"$ReportBasePath'"" -ForegroundColor Cyan }

# ============================================================================ # OUTPUT # ============================================================================

Write-Host "" Write-Host ("=" * 70) -ForegroundColor Green Write-Host " DEPLOYMENT COMPLETE" -ForegroundColor Green Write-Host ("=" * 70) -ForegroundColor Green "" Write-Host Write-Host "Düzenleyici yaklaşık 1 dakika içinde başlayacak." -ForegroundColor White "" Write-Host Write-Host "MONITORING:" -ForegroundColor Yellow Write-Host " Görev durumunu görüntüle: Get-ScheduledTask -TaskName '$TaskName' | Durum Seç" Write-Host " Görev günlüğünü görüntüle: Get-Content '$ReportBasePath\RolloutState\Orchestrator_$(Get-Date -Format 'yyyyMMdd').log' -Tail 50" Write-Host " Piyasaya çıkma durumunu görüntüle: '$ReportBasePath\RolloutState\RolloutState.json' Get-Content | ConvertFrom-Json" Write-Host " Panoyu görüntüle: '$ReportBasePath\Aggregation_*\SecureBoot_Dashboard*.html' öğesini başlatın" Write-Host " Hızlı durum: .\Get-SecureBootRolloutStatus.ps1 -ReportBasePath '$ReportBasePath'" "" Write-Host Write-Host "MANAGEMENT:" -ForegroundColor Yellow Write-Host " El ile başlat: Start-ScheduledTask -TaskName '$TaskName'" Write-Host " Durdur: Stop-ScheduledTask -TaskName '$TaskName'" Write-Host " Kaldır: .\Deploy-OrchestratorTask.ps1 -Uninstall" "" Write-Host  

Daha fazla yardıma mı ihtiyacınız var?

Daha fazla seçenek mi istiyorsunuz?

Abonelik avantajlarını keşfedin, eğitim kurslarına göz atın, cihazınızın güvenliğini nasıl sağlayacağınızı öğrenin ve daha fazlasını yapın.