Using RmtShare.exe, I have scripted SharedPrinters.bat to generate a CSV file that contains all the shared printers in your domain.
The syntax for using SharedPrinters.bat is:
SharedPrinters CSVFile
Where CSVFile is the file that will contain the CSV file, with content like:
"\\JSI001\ZFax","ZFax" "\\JSI001\HP2250","HP Business Inkjet 2250 (PCL5C)" "\\JSI009\HPOffice","HP Officejet 6200 series"SharedPrinters.bat contains:
@echo off if \{%1\}==\{\} @echo Syntax: SharedPrinters CSVFile&goto :EOF setlocal ENABLEDELAYEDEXPANSION set csvfile=%1 if exist %csvfile% del /q %csvfile% set dom=%USERDOMAIN% set b1=FIND /V ":" set b2=FIND /V "The command completed successfully." set b3=FIND "Path" for /f "Tokens=1" %%c in ('net view /domain:%dom%^|Findstr /L /C:"\\"') do ( set comp=%%c for /f "Skip=4 Tokens=*" %%p in ('rmtshare %%c^|%b1%^|%b2%') do ( set line=%%p if "!line:~13,1!" NEQ " " call :prt !line:~0,12! ) ) endlocal goto :EOF :prt for /f "Tokens=1*" %%x in ('rmtshare %comp%\%1^|%b3%') do ( set work=%%y set work=!work:,LocalsplOnly=! @echo "%comp%\%1","!work!">>%csvfile% )
0 comments
Hide comments