Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
November 15, 2005
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 offsetlocalset qry=ADFIND -default -nodn -csv -csvdelim ; -nocsvheader -f "(objectClass=printQueue)" shortServerName printShareName printerName location portName serverName driverName distinguishedNamefor /f "Tokens=1-8 Delims=;" %%a in ('%qry%') do ( @echo %%a;%%b;%%c;%%d;%%e;%%f;%%g;%%h)endlocal
PubPrint.bat used to contain:
@echo offsetlocalset qry=ADFIND -default -nodn -f "(objectClass=printQueue)" distinguishedName printerName printShareName portName driverName location shortServerName serverNamefor /f "Skip=3 Tokens=1* Delims=:" %%a in ('%qry%') do ( set p1=%%a set p2=%%b call :attr)endlocalgoto :EOF:attrset p1=%p1:~1,6%set p2=%p2:~1%if "%p1%" EQU "distin" set dn=%p2%&goto :EOFif "%p1%" EQU "locati" set loc=%p2%&goto :EOFif "%p1%" EQU "server" set sn=%p2%&goto :EOFif "%p1%" EQU "portNa" set port=%p2%&goto :EOFif "%p1%" EQU "driver" set drvr=%p2%&goto :EOFif "%p1%" EQU "printS" set shr=%p2%&goto :EOFif "%p1%" EQU "printe" set prtn=%p2%&goto :EOFif "%p1%" EQU "shortS" goto srvsngoto :EOF:srvsnset srvsn=%p2%@echo "%srvsn%";"%shr%";"%prtn%";"%loc%";"%port%";"%sn%";"%drvr%";"%dn%"set shr=set loc=set port=
You May Also Like