Terminal Server across a WAN, Printing from DOS to Network Printers.
Posted on 2003-10-21
Hi, I have windowz 98 boxes that have networked HP 4000tn printers
The w98 clients Terminal serve into the main office across a T.
The networked printer is created and works within all windows applications.
Opening a dos prompt and typing "net use" showed nothing mapped to LPT1 so..
#Script Time, First I delete anything mapped to LPT1
net use lpt1: /delete /y
#Then I get the users ID from the temp directory
for /f "eol=; tokens=6 delims=\ " %%i in ("%TEMP%") do set TSSID=%%i
#Then I get the users printer from the registry and attempt to map it
for /f "Tokens=2 Delims=, " %%i in ('REGfree.EXE -listvalue "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"') do set prt=%%i
#then I set the printers name
set TSPrinterName=%prt% %TSSID%
#Share the printer
rundll32 printui.dll,PrintUIEntry /Xs /n "%TSPrinterName%" sharename "TSPrinter%TSSID%" attributes +Shared
#Map the printer to LPT1
net use lpt1: \\127.0.0.1\TSPrinter%TSSID% /y
This works in windows 2000 but I have trouble with windows 98 boxes getting the:
for /f "Tokens=2 Delims=, " %%i in ('REGfree.......... information
The return value is "HP TSSID" but the printers name that I need to share is in the reg as "HP Laserjet 4000 series/BOB/Session 3"
Is there an easier was to share these printers and then map LPT to the shared printer.
Can anyone tell me how to modify the script so that it works on both win98 & win2k