Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have to connect a Windows 2008 server using Remote Desktop from Windows XP machine. A Barcode Printer is attached with XP machine and the printer is shared as Local Resource in RDC session to the server.

On the server we have to print from an application which prints either to LPT port or shared printer (UNC path). For this I use to configure print pooling combining LPT1 and (Terminal Server) TSxxx port. As I don't know the option to access the Terminal Session printer via UNC path.

But I have the following issues -

Every time I connect to a remote session, the printer from my local Win XP machine is showing in Printers and Faxes on Win 2008 Server (Terminal Server), but I am not allowed to manage the Win XP printer from Terminal Server to enable pooling. On the server I have to change the security permission every time and then enable print pooling. How can I keep the security permission unchanged?

Secondly I created a batch file to enable print pooling.

rundll32 printui.dll,PrintUIEntry /Xs /n "Printer (from CLIENT)" Portname "LPT1:,TS005"

But every time the printer in terminal session connects in diffrent terminal Session port. Any solution to make the TS port fixed?

Help from anyone will be highly appreciated.

share|improve this question

2 Answers 2

You can't get the parameters you are asking for "fixed" as printers are removed and re-created on every session disconnect/connect. So obviously, getting the application changed looks like the cleanest solution. If it can't be changed, you obviously could do a bit of scripting around the problem to ease the pain:

If your Windows XP machine is accessible through SMB from the terminal server, you obviously could just share the printer there and use the \\%clientname%\<printer> notation, but you probably have already thought of that and dismissed it for one reason or the other.

share|improve this answer
    
Thanks friend for your valuable tips. I shall definitely try them out. You are right, I don't have SMB access of my Win XP from Terminal Server as the server is o the cloud and I do RDC using a staic IP. –  Arindam Banerjee Oct 12 '12 at 4:56
    
Thanks a lot syneticon-dj. You guided me at right direction. I could make a workaround. But I SUBINACL was giving me 'Access Denied' error. So I tried with SetACL (ref: serverfault.com/questions/221682/…). It worked. Thanks alot. Qudos!! –  Arindam Banerjee Oct 17 '12 at 4:55
    
@ArindamBanerjee you are welcome. Feel free to edit the answer to include the SetACL command you've used and mark it as an answer solving the problem to help future visitors. –  the-wabbit Oct 17 '12 at 19:14
up vote 0 down vote accepted

Requirement:

  1. Printing from a Terminal Server host to the printer attached to TS Client over Remote Desktop Connection.
  2. Create a batch file to accomplish the above requirement.

Conditions:

  • TS Client connects TS Host using Static IP.
  • On TS Host, print can be sent only to LPT port. The application running there can't print to other printers except SMB shared printer or printer connected with LPT port.
  • Printer attached with TS Client will not be accessible using SMB share

Steps considered:

  • Printer on TS Client to be shared as Local Resource over Remote Desktop Connection
  • Printer available on TS Host redirected from TS Client having restricted access for the currently logged on RDC user. Hence, the current TS user must be granted with Printer Manage permission.
  • Enable Printer Pooling, as if print given to LPT port will be redirected to printer on other port

References and Tools:

Batch:

REM Begin of the script

REM Find out Session ID of Current RDC User using QUSER
QUSER CurrentTSUsername | FIND "CurrentTSUsername" > TSPrn_tmp.txt
FOR /F "tokens=1-3 delims= " %%i IN ('Type TSPrn_tmp.txt') DO SET TSID=%%k

REM Generate Printer name combining Printer name on Client and Terminal Session ID
SET PRINTER="ClientPrinter (redirected %TSID%)"

REM Grant ownership and Printer Manage Permission to current TS user using SETACL
SETACL -on %PRINTER% -ot prn -actn setowner -ownr n:CurrentTSUsername
SETACL -on %PRINTER% -ot prn -actn ace -ace "n:administrator;p:full"

REM Find out Terminal Session TSxxx port on which the printer mapped using Prncnfg.vbs
cscript %WINDIR%\System32\Printing_Admin_Scripts\en-US\prncnfg.vbs -g -p %PRINTER% | find "Port name" > TSPrn_tmp.txt
FOR /F "tokens=1-3" %%i IN ('TYPE TSPrn_tmp.txt') DO SET TSPORT=%%k

REM Enable Printer pooling combining LPT port and the TS Port
rundll32 printui.dll,PrintUIEntry /Xs /n %PRINTER% Portname "LPT1:,%TSPORT%"

REM Delete the Temp txt file
del TSPrn_tmp.txt

REM end of the script
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.