@echo off setlocal EnableExtensions DisableDelayedExpansion set "MODE=FULL" set "RUN_DIR=%CD%" set "START_DATE=%DATE%" set "START_TIME=%TIME%" set "IS_ADMIN=0" set "WARN_COUNT=0" set "SKIP_COUNT=0" set "CHECK_COUNT=0" fltmc >nul 2>&1 && set "IS_ADMIN=1" if "%IS_ADMIN%"=="0" net session >nul 2>&1 && set "IS_ADMIN=1" set "STAMP=%DATE%_%TIME%" set "STAMP=%STAMP:/=-%" set "STAMP=%STAMP:\=-%" set "STAMP=%STAMP::=-%" set "STAMP=%STAMP:.=-%" set "STAMP=%STAMP:,=-%" set "STAMP=%STAMP: =0%" where wmic.exe >nul 2>&1 if not errorlevel 1 for /f "tokens=2 delims==" %%A in ('wmic os get LocalDateTime /value 2^>nul ^| find "="') do if not defined DTS set "DTS=%%A" if defined DTS set "STAMP=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%_%DTS:~8,2%-%DTS:~10,2%-%DTS:~12,2%" set "REPORT=%RUN_DIR%\diagnostics_%STAMP%.txt" set "BATTERY=%RUN_DIR%\battery_%STAMP%.html" set "ENERGY=%RUN_DIR%\energy_%STAMP%.html" set "SLEEP=%RUN_DIR%\sleep_%STAMP%.html" set "POWER=%RUN_DIR%\power_%STAMP%.html" set "MSINFO=%RUN_DIR%\msinfo32_%STAMP%.txt" set "DXDIAG=%RUN_DIR%\dxdiag_%STAMP%.txt" set "GPRESULT=%RUN_DIR%\gpresult_%STAMP%.html" >"%REPORT%" echo ================================================================================ >>"%REPORT%" echo WINDOWS CMD DIAGNOSTIC REPORT - FULL - READ ONLY >>"%REPORT%" echo ================================================================================ >>"%REPORT%" echo Started: %START_DATE% %START_TIME% >>"%REPORT%" echo Working folder: %RUN_DIR% >>"%REPORT%" echo Elevated: %IS_ADMIN% >>"%REPORT%" echo. >>"%REPORT%" echo PRIVACY: Review and redact this report before sharing it. echo Windows CMD Full Diagnostic echo Report: "%REPORT%" echo Elevated: %IS_ADMIN% echo. call :section "EXECUTION CONTEXT" call :run "Command processor version" cmd.exe cmd.exe /d /c ver call :run "Current identity" whoami.exe whoami.exe call :run "Identity groups and privileges" whoami.exe whoami.exe /all call :run "Computer name" hostname.exe hostname.exe call :section "OPERATING SYSTEM AND HARDWARE" call :run "System information" systeminfo.exe systeminfo.exe call :run "Windows build registry data" reg.exe reg.exe query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" call :run "MSInfo32 report" msinfo32.exe msinfo32.exe /report "%MSINFO%" call :run "DirectX diagnostic report" dxdiag.exe dxdiag.exe /whql:off /dontskip /t "%DXDIAG%" call :run "CPU inventory" wmic.exe wmic.exe cpu get Name,Manufacturer,NumberOfCores,NumberOfLogicalProcessors,MaxClockSpeed /format:list call :run "Memory modules" wmic.exe wmic.exe memorychip get BankLabel,Capacity,ConfiguredClockSpeed,Manufacturer,PartNumber /format:list call :run "GPU inventory" wmic.exe wmic.exe path Win32_VideoController get Name,DriverVersion,DriverDate,AdapterRAM,Status /format:list call :run "Page file" wmic.exe wmic.exe pagefile list /format:list call :section "BOOT RECOVERY AND ENCRYPTION" call :run "Boot configuration" bcdedit.exe bcdedit.exe /enum all call :run "Windows Recovery Environment" reagentc.exe reagentc.exe /info call :run "BitLocker status" manage-bde.exe manage-bde.exe -status call :run "Secure Boot state" reg.exe reg.exe query "HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State" call :run "Pending component restart" reg.exe reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" call :run "Pending Windows Update restart" reg.exe reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" call :section "PROCESSES AND PERFORMANCE" call :run "Running processes" tasklist.exe tasklist.exe /v call :run "Processes mapped to services" tasklist.exe tasklist.exe /svc call :run "Performance sample" typeperf.exe typeperf.exe "\Processor(_Total)\%% Processor Time" "\Memory\Available MBytes" "\PhysicalDisk(_Total)\%% Disk Time" -sc 5 call :run "Performance counter registration" lodctr.exe lodctr.exe /q call :section "STORAGE AND FILE SYSTEM" call :run "Drive inventory" fsutil.exe fsutil.exe fsinfo drives call :run "Volumes and mount points" mountvol.exe mountvol.exe call :run "File-system filters" fltmc.exe fltmc.exe filters call :run "System-volume dirty bit" fsutil.exe fsutil.exe dirty query %SystemDrive% call :run "System-volume information" fsutil.exe fsutil.exe fsinfo volumeinfo %SystemDrive% call :run "Automatic disk-check configuration" chkntfs.exe chkntfs.exe %SystemDrive% call :run "Online system-volume scan" chkdsk.exe chkdsk.exe %SystemDrive% /scan call :run "Physical disks" wmic.exe wmic.exe diskdrive get Index,Model,FirmwareRevision,InterfaceType,MediaType,Size,Status /format:list call :run "Logical disk capacity" wmic.exe wmic.exe logicaldisk get DeviceID,DriveType,FileSystem,FreeSpace,Size,VolumeName /format:list call :section "BATTERY POWER AND SLEEP" call :run "Active power scheme" powercfg.exe powercfg.exe /getactivescheme call :run "Available power schemes" powercfg.exe powercfg.exe /list call :run "Supported sleep states" powercfg.exe powercfg.exe /a call :run "Last wake source" powercfg.exe powercfg.exe /lastwake call :run "Wake timers" powercfg.exe powercfg.exe /waketimers call :run "Power requests" powercfg.exe powercfg.exe /requests call :run "Wake-armed devices" powercfg.exe powercfg.exe /devicequery wake_armed call :run "Battery report" powercfg.exe powercfg.exe /batteryreport /output "%BATTERY%" call :run "Sleep diagnostics" powercfg.exe powercfg.exe /systemsleepdiagnostics /output "%SLEEP%" call :run "System power report" powercfg.exe powercfg.exe /systempowerreport /output "%POWER%" call :run "Energy analysis" powercfg.exe powercfg.exe /energy /duration 60 /output "%ENERGY%" call :run "Power-plan settings" powercfg.exe powercfg.exe /query call :section "DEVICES AND DRIVERS" call :run "Installed drivers" driverquery.exe driverquery.exe /v /fo list call :run "Third-party driver packages" pnputil.exe pnputil.exe /enum-drivers call :run "Connected devices" pnputil.exe pnputil.exe /enum-devices /connected call :run "Devices reporting problems" pnputil.exe pnputil.exe /enum-devices /problem /deviceids call :run "Device tree" pnputil.exe pnputil.exe /enum-devicetree call :section "NETWORK" call :run "IP configuration" ipconfig.exe ipconfig.exe /all call :run "Routing table" route.exe route.exe print call :run "ARP cache" arp.exe arp.exe -a call :run "Connections and listening ports" netstat.exe netstat.exe -ano call :run "Network interfaces" netsh.exe netsh.exe interface show interface call :run "IP interface configuration" netsh.exe netsh.exe interface ip show config call :run "WinHTTP proxy" netsh.exe netsh.exe winhttp show proxy call :run "Wi-Fi interfaces" netsh.exe netsh.exe wlan show interfaces call :run "Wi-Fi drivers" netsh.exe netsh.exe wlan show drivers call :run "DNS localhost test" nslookup.exe nslookup.exe localhost call :run "IPv4 loopback" ping.exe ping.exe -n 2 -w 1000 127.0.0.1 call :run "IPv6 loopback" ping.exe ping.exe -n 2 -w 1000 ::1 call :run "Winsock catalogue" netsh.exe netsh.exe winsock show catalog call :run "DNS cache" ipconfig.exe ipconfig.exe /displaydns call :section "SERVICES STARTUP AND TASKS" call :run "All service states" sc.exe sc.exe query type= service state= all call :run "Windows Update service" sc.exe sc.exe queryex wuauserv call :run "BITS service" sc.exe sc.exe queryex bits call :run "Update Orchestrator service" sc.exe sc.exe queryex usosvc call :run "Cryptographic Services" sc.exe sc.exe queryex cryptsvc call :run "Machine startup entries" reg.exe reg.exe query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" call :run "User startup entries" reg.exe reg.exe query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" call :run "Scheduled tasks" schtasks.exe schtasks.exe /query /fo list /v call :section "SECURITY AND POLICY" call :run "Firewall profiles" netsh.exe netsh.exe advfirewall show allprofiles call :run "Audit policy" auditpol.exe auditpol.exe /get /category:* call :run "Resultant policy summary" gpresult.exe gpresult.exe /r call :run "Domain and cloud registration" dsregcmd.exe dsregcmd.exe /status call :run "Local users" net.exe net.exe user call :run "Local groups" net.exe net.exe localgroup call :run "Network shares" net.exe net.exe share call :run "Group Policy HTML report" gpresult.exe gpresult.exe /h "%GPRESULT%" /f call :section "WINDOWS INTEGRITY - VERIFY ONLY" call :run "DISM CheckHealth" dism.exe dism.exe /Online /Cleanup-Image /CheckHealth call :run "SFC VerifyOnly" sfc.exe sfc.exe /verifyonly call :run "DISM ScanHealth" dism.exe dism.exe /Online /Cleanup-Image /ScanHealth call :run "Installed packages" dism.exe dism.exe /Online /Get-Packages /Format:Table call :run "Windows capabilities" dism.exe dism.exe /Online /Get-Capabilities /Format:Table call :section "EVENT LOGS" call :run "Recent critical System events" wevtutil.exe wevtutil.exe qe System /q:"*[System[(Level=1 or Level=2)]]" /rd:true /c:250 /f:text call :run "Recent critical Application events" wevtutil.exe wevtutil.exe qe Application /q:"*[System[(Level=1 or Level=2)]]" /rd:true /c:250 /f:text call :run "Unexpected shutdowns and bugchecks" wevtutil.exe wevtutil.exe qe System /q:"*[System[(EventID=41 or EventID=1001 or EventID=6008)]]" /rd:true /c:100 /f:text call :run "Storage and file-system events" wevtutil.exe wevtutil.exe qe System /q:"*[System[(EventID=7 or EventID=11 or EventID=15 or EventID=51 or EventID=55 or EventID=98 or EventID=129 or EventID=140 or EventID=153)]]" /rd:true /c:150 /f:text call :run "WHEA hardware events" wevtutil.exe wevtutil.exe qe System /q:"*[System[(EventID=1 or EventID=17 or EventID=18 or EventID=19 or EventID=20 or EventID=46 or EventID=47)]]" /rd:true /c:150 /f:text call :run "Windows Update warnings and errors" wevtutil.exe wevtutil.exe qe Microsoft-Windows-WindowsUpdateClient/Operational /q:"*[System[(Level=1 or Level=2 or Level=3)]]" /rd:true /c:150 /f:text call :section "CRASH EVIDENCE" call :run "Kernel memory dump" cmd.exe cmd.exe /d /c "dir /a /t:w %%SystemRoot%%\MEMORY.DMP" call :run "Minidump files" cmd.exe cmd.exe /d /c "dir /a /o:-d /t:w %%SystemRoot%%\Minidump\*.dmp" call :run "Windows Error Reporting archive" cmd.exe cmd.exe /d /c "dir /a /o:-d /t:w %%ProgramData%%\Microsoft\Windows\WER\ReportArchive" >>"%REPORT%" echo. >>"%REPORT%" echo ================================================================================ >>"%REPORT%" echo COLLECTION SUMMARY >>"%REPORT%" echo ================================================================================ >>"%REPORT%" echo Checks attempted: %CHECK_COUNT% >>"%REPORT%" echo Non-zero results: %WARN_COUNT% >>"%REPORT%" echo Missing tools: %SKIP_COUNT% >>"%REPORT%" echo Finished: %DATE% %TIME% echo. echo Complete. Report saved to: echo "%REPORT%" exit /b 0 :section >>"%REPORT%" echo. >>"%REPORT%" echo ================================================================================ >>"%REPORT%" echo %~1 >>"%REPORT%" echo ================================================================================ echo [FULL] %~1 exit /b 0 :run set /a CHECK_COUNT+=1 >nul set "RUN_TITLE=%~1" set "RUN_TOOL=%~2" >>"%REPORT%" echo. >>"%REPORT%" echo ------------------------------------------------------------------------------- >>"%REPORT%" echo CHECK %CHECK_COUNT%: %RUN_TITLE% >>"%REPORT%" echo Tool: %RUN_TOOL% >>"%REPORT%" echo Started: %DATE% %TIME% where "%RUN_TOOL%" >nul 2>&1 if errorlevel 1 ( >>"%REPORT%" echo [SKIPPED: TOOL NOT FOUND] %RUN_TOOL% set /a SKIP_COUNT+=1 >nul exit /b 0 ) %3 %4 %5 %6 %7 %8 %9 >>"%REPORT%" 2>&1 set "RUN_RC=%ERRORLEVEL%" >>"%REPORT%" echo Exit code: %RUN_RC% >>"%REPORT%" echo Finished: %DATE% %TIME% if not "%RUN_RC%"=="0" ( set /a WARN_COUNT+=1 >nul if "%IS_ADMIN%"=="0" ( >>"%REPORT%" echo [WARNING] Non-zero result. Elevation, unsupported hardware, absent data or a genuine finding may explain this. ) else ( >>"%REPORT%" echo [WARNING] Non-zero result. Review the command output above. ) ) else ( >>"%REPORT%" echo [COMPLETED] Read the output above; exit code zero does not alone prove health. ) exit /b 0