• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1182
  • Last Modified:

Thin Client with Terminal Services Printing

We have some HP T5145 thin clients which we use as point of sale systems.  Each one has an Eposn receipt printer connected to the parallel port.  When we connect the session to the Terminal Server, the printer is mapped and we can print to it from Windows.  The problem is that our POS system needs the printer to be mapped to an LPT port.

I can manually create a new printer, and manually select the TS003: PRN1 (or whatever) port that the client has connected on, share the printer and the use "net use" to map the correct LPT port but I need to be able to script this.

Probable steps:

1.  Find current TS session number
2.  Create new printer using this session number and share
3.  Net use ... etc
0
stumurray
Asked:
stumurray
  • 7
  • 4
  • 2
1 Solution
 
B HCommented:
can the terminal server address the local workstation that has the printer, by netbios name?
0
 
B HCommented:
if so, just share the printer as like for example "epson"
then on the server, net use lpt1: \\workstation\epson /persistent:yes

if not........  you're better off getting this epson onto a jetdirect, ethernet, with an ip address... and carve port tcp 9100 over in the firewal to nat over to the jetdirect....  then set up a new printer on the server, pointing to the ip address.... share it from the server, then
net use lpt1: \\server\sharename /persistent:yes

the old pos app won't even know what happened, but it'll work
0
 
Cláudio RodriguesFounder and CEOCommented:
I created a script to do exactly that and posted here on EE.
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Remote_Desktop-Terminal_Services/Q_24980006.html

That does all you are talking about, finding session number, printer name, etc and then sharing the mapped printer and mapping it using NET USE LPT1.

Cláudio Rodrigues
Citrix CTP
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
stumurrayAuthor Commented:
tsmvp,

Your script is exactly what I am looking for, however when I run it, I get an error saying "You do not have permission to modify settings for this printer".  Apparently redirected printer naming has been disabled in 2008......but I am unsure as to why we are renaming anything and not just creating a new printer...?

Thanks, nearly there!

Stuart
0
 
stumurrayAuthor Commented:
Am thinking that there is an issue with this script and the syntax change in 2008 - redirected printers show as PrinterName (redirected 5), the number being the session number...
0
 
Cláudio RodriguesFounder and CEOCommented:
Well in that case you may need to adjust the script based on the redirected name created on Server 2008.
Also the permissions issue may not be easy to fix. Have you looked at a tool called RenPrinters?
http://www.babbage-tech.com/products/renprinters/

Cláudio Rodrigues
Citrix CTP
0
 
stumurrayAuthor Commented:
But why are we renaming the printer?  I don't want to touch the existing one - I just want to create a new printer that uses the same port as the existing one.
0
 
Cláudio RodriguesFounder and CEOCommented:
In this case, modify the script to match the new naming convention. If you know scripting this should be VERY easy.
Next step, and you can try that as a user without even running the script, is to share the printer created by the TS for the user, using the 'rundll32 printui.dll,PrintUIEntry /Xs /n $TSPrinterName sharename $Sharename attributes +Shared'  where $TSPrinterName is the new naming convention that you can get off the registry key I read on the script.

Cláudio Rodrigues
Citrix CTP
 
0
 
stumurrayAuthor Commented:
This is the problem - you cannot share a redirected printer.  I need to create a new printer on the same port and then share that one.
0
 
Cláudio RodriguesFounder and CEOCommented:
Well if gets down to creating a new printer, you can script that I am certain.
http://support.microsoft.com/kb/189105

So the port you can use my script to find it (as it gets to the registry). Then create a new printer connected to the same port, share it and map it.
Would not that work?

Cláudio Rodrigues
Citrix CTP
0
 
stumurrayAuthor Commented:
Yes that will work - looks like I can create the printer using the printUI.dll: http://go.microsoft.com/fwlink/?LinkId=41178 

Now to combine your KIX script with the VB...
0
 
stumurrayAuthor Commented:
OK, have managed it:

;Delete existing printer
Shell 'rundll32 printui.dll,PrintUIEntry /dl /n "Generic / Text Only"'

;Read the default printer from the registry.
$DefaultPrinter = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device")

;Example: CutePDF Writer (redirected 51),winspool,TS064

;Extract Port Name
$PortName = Right("$DefaultPrinter","5")
 
;Create new printer on existing port number
Shell 'rundll32 printui.dll PrintUIEntry /if /f %windir%\inf\ntprint.inf /r "$PortName" /m "Generic / Text Only" /u'
;Share the printer
Shell 'rundll32 printui.dll,PrintUIEntry /Xs /n "Generic / Text Only" sharename "Receipt" attributes +Shared'

USE LPT2: /DELETE
USE LPT2: \\127.0.0.1\Receipt

Thanks Claudio - it was your script to get the data from the registry that I was missing.
0
 
stumurrayAuthor Commented:
Had to modify for Server 2008.  Provided script was to rename an existing printer which wasn't quite the requirement.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 7
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now