add diag1.ps1

This commit is contained in:
2026-07-30 09:04:57 +00:00
parent 661d2316b9
commit 6762c75771

114
diag1.ps1 Normal file
View File

@@ -0,0 +1,114 @@
# diag1.ps1 - быстрая диагностика: SMART + журнал + тест чтения файлов CS2
# Запуск от администратора: powershell -NoProfile -ExecutionPolicy Bypass -File C:\diag1.ps1
$ErrorActionPreference = 'Continue'
$out = "$env:USERPROFILE\Desktop\diag1.txt"
Start-Transcript -Path $out -Force | Out-Null
function H($t) { "`n" + ('=' * 70); "== $t"; ('=' * 70) }
H "СИСТЕМА"
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber, LastBootUpTime | Format-List
Get-CimInstance Win32_Processor | Select-Object Name, CurrentClockSpeed, MaxClockSpeed | Format-List
H "ПАМЯТЬ (Speed = профиль, ConfiguredClockSpeed = фактическая; расхождение = XMP/EXPO)"
Get-CimInstance Win32_PhysicalMemory |
Select-Object DeviceLocator, Manufacturer, PartNumber, @{n='GB';e={$_.Capacity/1GB}}, Speed, ConfiguredClockSpeed, ConfiguredVoltage |
Format-Table -AutoSize
H "ВИДЕОКАРТА И ДРАЙВЕР"
Get-CimInstance Win32_VideoController | Select-Object Name, DriverVersion, DriverDate, AdapterRAM | Format-List
H "ДИСКИ"
Get-PhysicalDisk | Select-Object DeviceId, FriendlyName, MediaType, BusType, HealthStatus, OperationalStatus, @{n='GB';e={[int]($_.Size/1GB)}} | Format-Table -AutoSize
Get-Disk | Select-Object Number, FriendlyName, SerialNumber, FirmwareVersion, HealthStatus | Format-Table -AutoSize
Get-Volume | Where-Object DriveLetter | Select-Object DriveLetter, FileSystem, HealthStatus, @{n='FreeGB';e={[int]($_.SizeRemaining/1GB)}}, @{n='SizeGB';e={[int]($_.Size/1GB)}} | Format-Table -AutoSize
H "СЧЁТЧИКИ НАДЁЖНОСТИ (Windows)"
foreach ($pd in Get-PhysicalDisk) {
"--- Диск $($pd.DeviceId): $($pd.FriendlyName)"
$pd | Get-StorageReliabilityCounter |
Select-Object Temperature, TemperatureMax, ReadErrorsTotal, ReadErrorsCorrected, ReadErrorsUncorrected,
WriteErrorsTotal, WriteErrorsCorrected, WriteErrorsUncorrected, Wear, PowerOnHours, StartStopCycleCount |
Format-List
}
H "SMART (smartctl)"
$sm = "C:\Program Files\smartmontools\bin\smartctl.exe"
if (-not (Test-Path $sm)) {
"smartctl не найден, ставлю через winget..."
winget install --id smartmontools.smartmontools -e --silent --accept-source-agreements --accept-package-agreements 2>&1 | Out-String
}
if (Test-Path $sm) {
$devs = & $sm --scan 2>&1 | ForEach-Object { if ($_ -match '^(\S+)\s') { $Matches[1] } }
foreach ($d in $devs) { "`n--- $d"; & $sm -a $d 2>&1 }
} else {
"!!! smartctl поставить не удалось. Ставим вручную: https://sourceforge.net/projects/smartmontools/"
}
H "СОБЫТИЯ ЖУРНАЛА ЗА 30 ДНЕЙ (диск, ФС, GPU, креши)"
$since = (Get-Date).AddDays(-30)
$providers = @(
@{n='disk'; f=@{ProviderName='disk'; StartTime=$since}},
@{n='Ntfs'; f=@{ProviderName='Microsoft-Windows-Ntfs'; StartTime=$since}},
@{n='storahci'; f=@{ProviderName='storahci'; StartTime=$since}},
@{n='stornvme'; f=@{ProviderName='stornvme'; StartTime=$since}},
@{n='volmgr'; f=@{ProviderName='volmgr'; StartTime=$since}},
@{n='WHEA-Logger'; f=@{ProviderName='Microsoft-Windows-WHEA-Logger'; StartTime=$since}},
@{n='Display (TDR)'; f=@{ProviderName='Display'; StartTime=$since}},
@{n='amdkmdag'; f=@{ProviderName='amdkmdag'; StartTime=$since}},
@{n='Application Error'; f=@{ProviderName='Application Error'; StartTime=$since}},
@{n='BugCheck'; f=@{ProviderName='Microsoft-Windows-Kernel-Power'; ID=41; StartTime=$since}}
)
foreach ($p in $providers) {
"`n--- $($p.n)"
try {
$ev = Get-WinEvent -FilterHashtable $p.f -MaxEvents 40 -ErrorAction Stop
$ev | Select-Object TimeCreated, Id, LevelDisplayName, @{n='Msg';e={($_.Message -replace '\s+',' ').Substring(0, [Math]::Min(180, $_.Message.Length))}} |
Format-Table -AutoSize -Wrap
} catch { "нет событий" }
}
H "ПОИСК БИБЛИОТЕК STEAM"
$libs = @()
foreach ($drv in (Get-Volume | Where-Object { $_.DriveLetter -and $_.FileSystem -eq 'NTFS' }).DriveLetter) {
foreach ($cand in @("${drv}:\steam\steamapps\common", "${drv}:\SteamLibrary\steamapps\common", "${drv}:\Program Files (x86)\Steam\steamapps\common")) {
if (Test-Path $cand) { $libs += $cand; "найдено: $cand" }
}
}
if (-not $libs) { "!!! Библиотеки Steam не найдены по стандартным путям" }
H "ТЕСТ ЧТЕНИЯ: vanity-файлы CS2 (падают только в премьере) + мелкие vpk"
function Test-Read($path) {
try {
$fs = [IO.File]::Open($path, 'Open', 'Read', 'Read')
$buf = New-Object byte[] 4194304
$sw = [Diagnostics.Stopwatch]::StartNew()
$total = 0
while (($n = $fs.Read($buf, 0, $buf.Length)) -gt 0) { $total += $n }
$sw.Stop(); $fs.Close()
$mb = $total / 1MB
$spd = if ($sw.Elapsed.TotalSeconds -gt 0) { $mb / $sw.Elapsed.TotalSeconds } else { 0 }
"OK {0,8:N1} MB {1,7:N1} MB/s {2}" -f $mb, $spd, $path
} catch {
"FAIL $path`n -> $($_.Exception.Message)"
}
}
$cs2 = $libs | ForEach-Object { Join-Path $_ 'Counter-Strike Global Offensive' } | Where-Object { Test-Path $_ } | Select-Object -First 1
if ($cs2) {
"CS2: $cs2"
$maps = Get-ChildItem -Path $cs2 -Recurse -Filter '*.vpk' -File -ErrorAction SilentlyContinue |
Where-Object { $_.Name -like '*vanity*' -or $_.Length -lt 200MB }
"Файлов к проверке: $($maps.Count)"
foreach ($m in $maps) { Test-Read $m.FullName }
} else {
"!!! Папка CS2 не найдена"
}
H "CHKDSK E: /scan (только чтение, без правки)"
if (Test-Path 'E:\') { chkdsk E: /scan } else { "диска E нет" }
H "ГОТОВО. Отчёт: $out"
Stop-Transcript | Out-Null
Write-Host "`nОтчёт сохранён: $out" -ForegroundColor Green