@echo off REM --------------------------------------------------------------------------- REM PC audit collector - just double-click this file. REM REM It reads Windows settings and writes ONE report file into this folder. REM (Windows' own dxdiag/powercfg tools also leave two temporary files in REM your Temp folder.) It changes nothing else and makes no internet REM connection. REM REM Keep this file in the same folder as collect.ps1. REM --------------------------------------------------------------------------- setlocal title PC audit collector echo. if not exist "%~dp0collect.ps1" ( echo PROBLEM: collect.ps1 is not in this folder. echo Keep both files together, then run this again. echo. pause exit /b 1 ) REM Build the report name here so the closing message can state it exactly, REM rather than describing it. Batch date parsing is locale-dependent, so the REM timestamp comes from PowerShell. set "STAMP=" for /f "usebackq delims=" %%T in (`powershell -NoProfile -ExecutionPolicy Bypass -Command "(Get-Date).ToString('yyyyMMdd-HHmmss')"`) do set "STAMP=%%T" if not defined STAMP set "STAMP=report" set "REPORTNAME=pcaudit-%STAMP%.json" REM fltmc only succeeds when elevated - cheapest admin test that needs no tools. fltmc >nul 2>&1 if errorlevel 1 goto notadmin REM The collector prints its own banner, progress and closing summary. Do not REM restate the filename or the "nothing was changed" line here - it was said REM three times across the two files before this was trimmed. powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0collect.ps1" -OutFile "%~dp0%REPORTNAME%" -IncludeEnergyReport goto done :notadmin echo This is NOT running as administrator. echo. echo It still works, but a few things cannot be read without it. echo For the complete report: close this window, right-click echo PC-Audit-RUN-AS-ADMIN.bat, and choose "Run as administrator". echo. echo Press any key to continue anyway, or close this window. pause >nul powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0collect.ps1" -OutFile "%~dp0%REPORTNAME%" :done if not exist "%~dp0%REPORTNAME%" ( echo. echo The report was not saved in this folder - check the messages above. echo. ) pause endlocal