Using RMTShare.exe, I have scripted SamePrinter.bat to report any printer shares that exists
on computer1 that do not exists on computer2.
The syntax for using SamePrinter.bat is:
SamePrinter Computer1 Computer2
Where Computer1 and Computer2 are the NetBIOS computer names, and may not contain spaces.
NOTE: SamePrinter.bat requires that a printer share be from 1 to 12 characters and does not contain spaces.
SamePrinter.bat contains:
@echo off if \{%2\}==\{\} @echo Syntax SamePrinter Computer1 Computer2&goto :EOF setlocal ENABLEDELAYEDEXPANSION set c1=%1 set c2=%2 set c1=%c1:"=% set c1=\\%c1:\=% set c2=%c2:"=% set c2=\\%c2:\=% set b1=FIND /V ":" set b2=FIND /V "The command completed successfully." for /f "Skip=4 Tokens=*" %%a in ('rmtshare %c1%^|%b1%^|%b2%') do ( set line=%%a if "!line:~13,1!" NEQ " " call :c1prt !line:~0,12! ) endlocal goto :EOF :c1prt set prt=%1 set OK=N for /f "Skip=4 Tokens=*" %%b in ('rmtshare %c2%^|%b1%^|%b2%') do ( set work=%%b if "!work:~13,1!" NEQ " " call :c2prt !work:~0,12! ) if "%OK%" EQU "Y" goto :EOF @echo %c1% - %prt% - does NOT exist on %c2% goto :EOF :c2prt if /i "%1" NEQ "%prt%" goto :EOF set OK=Y
0 comments
Hide comments