@echo off setlocal EnableExtensions set "OUTDIR=%~dp0reports" set "OUT=%OUTDIR%\printer-list.txt" if not exist "%OUTDIR%" mkdir "%OUTDIR%" where powershell >nul 2>&1 if errorlevel 1 ( echo PowerShell not found. exit /b 1 ) echo Printer and scanner list > "%OUT%" echo Generated: %DATE% %TIME% >> "%OUT%" echo. >> "%OUT%" echo Printers >> "%OUT%" powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-Printer | Select-Object Name,DriverName,PortName,PrinterStatus | Format-Table -AutoSize" >> "%OUT%" 2>&1 echo. >> "%OUT%" echo Scanners and imaging devices >> "%OUT%" powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-PnpDevice -Class Image -ErrorAction SilentlyContinue | Select-Object FriendlyName,Status,InstanceId | Format-Table -AutoSize" >> "%OUT%" 2>&1 echo Report saved to "%OUT%" echo Printers and scanners were only listed, nothing was changed. exit /b 0