@echo off setlocal EnableExtensions set "OUTDIR=%~dp0reports" set "OUT=%OUTDIR%\hotfix-list.txt" if not exist "%OUTDIR%" mkdir "%OUTDIR%" where powershell >nul 2>&1 if errorlevel 1 ( echo PowerShell not found. exit /b 1 ) echo Installed updates > "%OUT%" echo Generated: %DATE% %TIME% >> "%OUT%" echo. >> "%OUT%" powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-HotFix | Sort-Object InstalledOn -Descending | Format-Table -AutoSize" >> "%OUT%" 2>&1 echo Report saved to "%OUT%" echo Updates were only listed, nothing was installed or removed. exit /b 0