Загрузка данных


$out = "$env:USERPROFILE\Desktop\VMX_Boot_Diagnostic.txt"
$since = (Get-Date).AddHours(-3)

"=== DATE ===" | Set-Content $out
Get-Date | Out-String | Add-Content $out

"`n=== BCD ===" | Add-Content $out
bcdedit /enum '{current}' 2>&1 | Out-String | Add-Content $out

"`n=== DEVICE GUARD / VBS ===" | Add-Content $out
Get-CimInstance -Namespace root\Microsoft\Windows\DeviceGuard -ClassName Win32_DeviceGuard -ErrorAction SilentlyContinue |
    Format-List * | Out-String -Width 300 | Add-Content $out

"`n=== FACEIT / SECURITY DRIVERS ===" | Add-Content $out
Get-CimInstance Win32_SystemDriver |
    Where-Object {
        $_.Name -match 'faceit|kaspersky|kl|hyper|hv' -or
        $_.PathName -match 'faceit|kaspersky'
    } |
    Select-Object Name,State,StartMode,PathName |
    Format-Table -AutoSize | Out-String -Width 300 | Add-Content $out

"`n=== RECENT CRITICAL AND ERROR EVENTS ===" | Add-Content $out
Get-WinEvent -FilterHashtable @{LogName='System'; StartTime=$since} -ErrorAction SilentlyContinue |
    Where-Object {
        $_.Level -le 2 -or
        $_.ProviderName -match 'Hyper-V|Kernel-Boot|Kernel-Power|BugCheck|WHEA'
    } |
    Select-Object TimeCreated,ProviderName,Id,LevelDisplayName,Message |
    Format-List | Out-String -Width 300 | Add-Content $out

"`n=== STARTUP REPAIR LOG ===" | Add-Content $out
Get-Content "$env:SystemRoot\System32\LogFiles\Srt\SrtTrail.txt" -ErrorAction SilentlyContinue |
    Out-String | Add-Content $out

"`n=== MINIDUMPS ===" | Add-Content $out
Get-ChildItem "$env:SystemRoot\Minidump" -ErrorAction SilentlyContinue |
    Select-Object Name,Length,LastWriteTime |
    Format-Table -AutoSize | Out-String | Add-Content $out

Write-Host "Готово: $out" -ForegroundColor Green