# check_servicing.ps1 — raportează dacă stack-ul de servicing Windows este activ. # # De ce există: incident 2026-08-08. KB5101001 a fost descărcat în timpul testului # DR din 2026-08-01 (singurul moment în care VM 109 este pornit), a rămas staged # după `qm stop`, și s-a finalizat la următorul boot — adică exact la testul # următor. RestartManager a omorât procesul powershell.exe care rula restore-ul # (event 10010), apoi sshd (SCM 7034), iar VM-ul a rebootat la 72s după boot. # Testul a raportat "Restore failed" fără niciun log RMAN, deși RMAN nici măcar # nu apucase să pornească. # # Ieșire (o singură linie, parsabilă din bash): # STATE=IDLE # STATE=BUSY REBOOT_PENDING= REASONS= # # Cod de ieșire: 0 = IDLE, 1 = BUSY. Nu aruncă niciodată excepții — un check # care crapă nu are voie să pice testul DR. $ErrorActionPreference = "SilentlyContinue" $reasons = @() $rebootPending = $false # 1. Component Based Servicing: update aplicat, așteaptă reboot. if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") { $reasons += "CBS_RebootPending" $rebootPending = $true } # 2. Windows Update: reboot cerut explicit. if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\NT\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") { $reasons += "WU_RebootRequired" $rebootPending = $true } # 3. Fișiere programate pentru redenumire la boot (semnătură clasică de servicing). $pfro = (Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations).PendingFileRenameOperations if ($pfro) { $reasons += "PendingFileRename" $rebootPending = $true } # 4. Redenumire de computer în așteptare — tot reboot cere. if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\PostRebootReporting") { $reasons += "PostRebootReporting" } # 5. TiWorker.exe = worker-ul de servicing. Prezent => CBS lucrează chiar acum. if (Get-Process -Name "TiWorker" -ErrorAction SilentlyContinue) { $reasons += "TiWorker_running" } # 6. TrustedInstaller pornit => Windows Modules Installer aplică ceva. if ((Get-Service -Name "TrustedInstaller" -ErrorAction SilentlyContinue).Status -eq "Running") { $reasons += "TrustedInstaller_running" } # 7. Update Orchestrator activ => descărcare/scheduling în curs. if ((Get-Service -Name "UsoSvc" -ErrorAction SilentlyContinue).Status -eq "Running") { $reasons += "UsoSvc_running" } # Notă: wuauserv nu este verificat intenționat — pornește și se oprește de la # sine în mod normal (inclusiv pentru definițiile Defender) și ar produce # fals-pozitive la fiecare rulare. if ($reasons.Count -eq 0) { Write-Output "STATE=IDLE" exit 0 } else { Write-Output ("STATE=BUSY REBOOT_PENDING=" + $rebootPending.ToString().ToLower() + " REASONS=" + ($reasons -join ",")) exit 1 }