# diag3.ps1 - съём улик СРАЗУ ПОСЛЕ вылета игры (окно 12 часов) # Запускать от администратора после того, как вылет воспроизведён. # [Net.ServicePointManager]::SecurityProtocol='Tls12'; irm https://git.dttb.ru/oleg/scripts/raw/branch/main/diag3.ps1 | iex $ErrorActionPreference = 'Continue' $isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { Write-Host "`n!!! НУЖНЫ ПРАВА АДМИНИСТРАТОРА. Win+X -> 'Терминал (администратор)'`n" -ForegroundColor Red return } $out = "$env:USERPROFILE\Desktop\diag3.txt" Start-Transcript -Path $out -Force | Out-Null function Sec($t) { "`n" + ('=' * 72); "== $t"; ('=' * 72) } $since = (Get-Date).AddHours(-12) "Окно поиска: с $since по $(Get-Date)" Sec "СОБЫТИЯ ЗА 12 ЧАСОВ - ВСЁ ЗНАЧИМОЕ" $provs = @( @{n='Display (TDR 4101 = зависание драйвера GPU)'; f=@{ProviderName='Display'; StartTime=$since}}, @{n='amdkmdag / amdwddmg'; f=@{ProviderName='amdkmdag','amdwddmg'; StartTime=$since}}, @{n='Application Error (креши)'; f=@{ProviderName='Application Error'; StartTime=$since}}, @{n='Application Hang'; f=@{ProviderName='Application Hang'; StartTime=$since}}, @{n='WHEA-Logger (аппаратные)'; f=@{ProviderName='Microsoft-Windows-WHEA-Logger'; StartTime=$since}}, @{n='Kernel-Power 41 (аварийное выключение)'; f=@{ProviderName='Microsoft-Windows-Kernel-Power'; StartTime=$since}}, @{n='BugCheck (BSOD)'; f=@{ProviderName='Microsoft-Windows-WER-SystemErrorReporting'; StartTime=$since}}, @{n='disk / storahci'; f=@{ProviderName='disk','storahci'; StartTime=$since}}, @{n='Ntfs (только ошибки)'; f=@{ProviderName='Microsoft-Windows-Ntfs'; Level=1,2,3; StartTime=$since}}, @{n='LiveKernelEvent'; f=@{ProviderName='Microsoft-Windows-WER-Diagnostics'; StartTime=$since}} ) foreach ($p in $provs) { "`n--- $($p.n)" try { Get-WinEvent -FilterHashtable $p.f -MaxEvents 30 -ErrorAction Stop | Select-Object TimeCreated, Id, LevelDisplayName, ProviderName, @{n='Msg';e={($_.Message -replace '\s+',' ')}} | Format-List } catch { "нет событий" } } Sec "ОТЧЁТЫ О СБОЯХ ЯДРА (TDR пишет сюда дамп)" $lkr = "$env:SystemRoot\LiveKernelReports" if (Test-Path $lkr) { Get-ChildItem $lkr -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-14) } | Select-Object LastWriteTime, @{n='MB';e={[math]::Round($_.Length/1MB,1)}}, FullName | Sort-Object LastWriteTime -Descending | Format-Table -AutoSize } else { "каталога нет" } Sec "ОЧЕРЕДЬ WER (несданные отчёты о падениях)" foreach ($d in @("$env:ProgramData\Microsoft\Windows\WER\ReportQueue", "$env:LOCALAPPDATA\Microsoft\Windows\WER\ReportQueue")) { if (Test-Path $d) { Get-ChildItem $d -Directory -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-14) } | Sort-Object LastWriteTime -Descending | Select-Object -First 15 | ForEach-Object { "--- $($_.Name) ($($_.LastWriteTime))" $rep = Join-Path $_.FullName 'Report.wer' if (Test-Path $rep) { Get-Content $rep -ErrorAction SilentlyContinue | Select-String -Pattern 'AppName|AppPath|Sig\[\d\]\.Value|ExceptionCode|ProblemType' | ForEach-Object { " " + $_.Line.Trim() } } } } } Sec "МИНИДАМПЫ" foreach ($d in @("$env:SystemRoot\Minidump", "$env:LOCALAPPDATA\CrashDumps")) { if (Test-Path $d) { "--- $d" Get-ChildItem $d -File -ErrorAction SilentlyContinue | Select-Object LastWriteTime, @{n='MB';e={[math]::Round($_.Length/1MB,1)}}, Name | Sort-Object LastWriteTime -Descending | Format-Table -AutoSize } } Sec "ЛОГИ ADRENALIN (если включено логирование метрик)" foreach ($d in @("$env:USERPROFILE\Documents\AMD", "$env:USERPROFILE\Documents\Radeon Software", "$env:LOCALAPPDATA\AMD")) { if (Test-Path $d) { Get-ChildItem $d -Recurse -Include '*.csv','*.txt' -File -ErrorAction SilentlyContinue | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-3) } | Select-Object LastWriteTime, @{n='KB';e={[math]::Round($_.Length/1KB,1)}}, FullName | Format-Table -AutoSize } } Sec "ТЕКУЩЕЕ СОСТОЯНИЕ GPU И ПИТАНИЯ" Get-CimInstance Win32_VideoController | Select-Object Name, DriverVersion, DriverDate, CurrentRefreshRate, VideoModeDescription | Format-List "--- Схема электропитания:" powercfg /getactivescheme "--- Отчёт о батарее/питании пропущен (стационарный ПК)" Sec "ЦЕЛОСТНОСТЬ VANITY-ФАЙЛОВ CS2 (чтение с замером)" $cs2 = 'E:\steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\maps' if (Test-Path $cs2) { $buf = New-Object byte[] 4194304 foreach ($f in Get-ChildItem $cs2 -Filter '*vanity*' -File) { try { $fs = [IO.File]::Open($f.FullName, 'Open', 'Read', 'Read') $sw = [Diagnostics.Stopwatch]::StartNew(); $tot = 0 while (($k = $fs.Read($buf, 0, $buf.Length)) -gt 0) { $tot += $k } $sw.Stop(); $fs.Close() $mb = $tot / 1MB $s = if ($sw.Elapsed.TotalSeconds -gt 0) { $mb / $sw.Elapsed.TotalSeconds } else { 0 } "OK {0,7:N1} MB {1,7:N1} MB/s {2}" -f $mb, $s, $f.Name } catch { "FAIL $($f.Name) -> $($_.Exception.Message)" } } } else { "каталог карт не найден" } Sec "ГОТОВО" "Отчёт: $out" Stop-Transcript | Out-Null Write-Host "`nОтчёт сохранён: $out" -ForegroundColor Green