@echo off
setlocal
set ServerFile=test.txt
set ResultFile=test.csv
set DumpsecFile=%~dpn0.tmp
if exist "%ResultFile%" del "%ResultFile%"
for /f "tokens=1" %%a in ('type "%ServerFile%"') do call :process %%a
goto :eof
:process
set Server=%~1
echo Processing %Server% ...
dumpsec /computer=\\%Server% /rpt=rights /outfile=%DumpsecFile% /saveas=csv /noheader
for /f "tokens=1,2 delims=," %%a in ('type "%DumpSecFile%" ^| findstr "SeBatchLogonRight SeServiceLogonRight"') do (
>>"%ResultFile%" echo "%Server%","%%a","%%b"
)
|