A new version of ADFind.exe freeware has many useful options.
I specially like the -oao and -csv options.
As a demonstration of usefulness, I have re-written the PubPrint.bat script to contain:
@echo off setlocal set qry=ADFIND -default -nodn -csv -csvdelim ; -nocsvheader -f "(objectClass=printQueue)" shortServerName printShareName printerName location portName serverName driverName distinguishedName for /f "Tokens=1-8 Delims=;" %%a in ('%qry%') do ( @echo %%a;%%b;%%c;%%d;%%e;%%f;%%g;%%h ) endlocalPubPrint.bat used to contain:
@echo off setlocal set qry=ADFIND -default -nodn -f "(objectClass=printQueue)" distinguishedName printerName printShareName portName driverName location shortServerName serverName for /f "Skip=3 Tokens=1* Delims=:" %%a in ('%qry%') do ( set p1=%%a set p2=%%b call :attr ) endlocal goto :EOF :attr set p1=%p1:~1,6% set p2=%p2:~1% if "%p1%" EQU "distin" set dn=%p2%&goto :EOF if "%p1%" EQU "locati" set loc=%p2%&goto :EOF if "%p1%" EQU "server" set sn=%p2%&goto :EOF if "%p1%" EQU "portNa" set port=%p2%&goto :EOF if "%p1%" EQU "driver" set drvr=%p2%&goto :EOF if "%p1%" EQU "printS" set shr=%p2%&goto :EOF if "%p1%" EQU "printe" set prtn=%p2%&goto :EOF if "%p1%" EQU "shortS" goto srvsn goto :EOF :srvsn set srvsn=%p2% @echo "%srvsn%";"%shr%";"%prtn%";"%loc%";"%port%";"%sn%";"%drvr%";"%dn%" set shr= set loc= set port=
0 comments
Hide comments