Solved

Redirect LPT1 to Default Printer

Posted on 2003-11-03
15
80,118 Views
Last Modified: 2012-06-21
A department in our corporation uses and old DOS type program for some of its more critical functions.  The way the program is written, it will only print to LPT1.  The department has several hundred workstations and many different printers, so pointing LPT1 to a single printer is not an effective solution.  I am looking for a way to have LPT1 automatically redirect to the default printer for that particular workstation.  I don't mind installing a small client on the desktop to accomplish this.  Has anyone had a similar issue, any ideas?  Can the mode command be used?

Windows 2000, SP3 printing to varying models of HP LaserJet and Lexmark printers connected directly to the network with their own IP address.
0
Comment
Question by:ednetman
  • 6
  • 3
  • 2
  • +4
15 Comments
 
LVL 62

Expert Comment

by:☠ MASQ ☠
Comment Utility
You should be able to redirect by capturing the printer port in printer settings

This Googled from (http://www.edimax.com/html/Faq/FAQ_PSwin.htm)

Q:  I need to print from a DOS application. How can I do that?

The DOS program only can print to LPT1 or LPT2 of the local printer port of computers.  Therefore, you need to capture printer port and redirect the LPT1 to a network printer port for the Print Server.

The procedure for windows 2000 and XP workstations is not the same with the procedure for windows 95/98/NT/ME.

For windows 95/98/NT/ME network, you need to share the printer from one computer so another computer can do the redirection.  It  means one of your computer needs to be on for other computers can print the DOS program.  In our example below, machine B is the windows 95/98/NT/ME machine that needs to print DOS application.

First of all, make sure you have one machine (suppose machine A) print fine from a windows application to the print server device.  Then click on Start button.  Select Settings.  Select Printers.  Right click the mouse on the printer icon and then select Sharing.   If you do not have the sharing option, you need to enable the File and Printer sharing option in Network of Control Panel.
Under Sharing, enable the sharing and assign a share name (suppose HP4000sharing) then click OK.  You will see a hand underneath the printer icon.
Find out  the computer name by going to Network in Control Panel.  Click on the Identification tab.  You will see the computer name.  Write the computer name down.  Here in our example, we use machine A as the computer name.
Go to the machine (suppose machine B) that needs to print the DOS application.  Click on the Start button.  Select Settings.  Select Printers.  Right click the mouse on the printer icon and select Properties.  Click on the Detailed tab.
Click Capture Printer Ports button.  Make sure you select LPT1.  In path, type \\ComputerName\ShareName which computer name and Printer share name are the names in step 2 and step 3 above.  In our example, it is \\machine A \HP4000sharing.
Check the option 'reconnect at logon'.  By doing so, you will save the settings even you reboot your system.
Click OK.  And click Apply or OK button.
Now you can test print your DOS application from your computer machine B.

If your machine B runs windows 2000 or windows XP, you do not need Machine A share the printer.  Have the windows 2000 and XP share the printer and redirect LPT1 to the computer itself.  For example, in step 5, machine B can redirect LPT1 to \\machine B \HP4000sharing directly.


0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
Good try, but not quite what I was looking for. That would require mapping LTP1 on several hundred workstations. Since I don't know what printer each user has set up, this could take days to deploy. I was thinking of some king of DOS command or clinet that I could push remotly using Ghost, set a shortcut in "All Users" startup to redirect LPT1 to whichever printer this user has selected as their default. The users have the ability to change their default printer amoung the list of installed printers we provide, however they cannot add or delete them.  this is especially usefull when a printer goes down.
0
 
LVL 62

Expert Comment

by:☠ MASQ ☠
Comment Utility
How about creating a utility that finds the default printer & then remaps it?

Detect default printer ....

----------------------
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Wscript.Shell")

sOSversion = GetOS() 'Return either WinNT/2K or Win9x/Me

If sOSversion = "WinNT/2K" Then
sOldDefPrtr = oShell.RegRead(_
"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion" & _
"\Windows\Device")

Elseif sOSversion = "Win9x/Me" Then
sCurrentConfig = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\IDConfigDB" & _
"\CurrentConfig")
sPrtrName = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\Config\" & sCurrentConfig & "\System" & _
"\CurrentControlSet\Control\Print\Printers\Default")
sOldDefPrtr = oShell.RegRead(_
"HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print" & _
"\Printers\" & sPrtrName & "\Port")

Else
sNewDefPrtr = "Undetermined! (Old default printer could not be
recognized.)"
End If
--------------------
0
 

Expert Comment

by:Max88Can
Comment Utility
My solution should work for you but if you already have a hundred computers deployed each one will probably have to be updated.  I don't know how to push printer settings down to workstations but if you can install or reconfigure workstations using ghost  then this might work.

On the computer with the default image, go to the properties window for each printer on your network and perform the following steps.  

1. Go to the ports tab and check the "Enable Printer Pooling" checkbox.  

2. Now in the list of ports check LPT1.  You should now have two ports checked, the orignal port for the network printer and the LPT1 port.  

The concept here is a printer pool is a collection of printers that are exactly the same and when printing to this type of printer the first available printer is chosen to be printed to.  By performing the above steps you have created a bunch of printer pools that consist of one printer and an LPT1 port.  When a job is directed to LPT1 and since there is no printer there, it will print to the "other" printer in the pool.

So when a user selects their default printer, they will have the ability to print to LPT1 without you having to know the default printer name.

Hope this helps.



0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
Wow!  That's a cool trick.  Problem is that the users can select their default printer so I would not know which printer to add the print spool to.  I think I am looking for a batch file, VB Script, or executable that can gather the profile specific settings and make the changes for me.
0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
The printer pooling trick works.  Does anyone know of a batch file or VB Script that can enable printer pooling and then select LPT1?  I know the port names for all the existing printers, however the IP adresses vary widely.
0
 

Expert Comment

by:Max88Can
Comment Utility
I found this on Microsoft's technet, it uses VB scripting to get things done.  Maybe some of the information found here could be used as a basis to push down your printer settings.

http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/printing/ScrPrn16.asp
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Expert Comment

by:TerranIT
Comment Utility
Something we used to do on an NT network a few years back might be useful for you in this situation. If you can map network drives, or print to network printers, this should work for you.

NET USE

This command allows you to map a local drive -or devicename- to a network resource. In this instance, you'll want to use the following syntax:

NET USE [devicename] \\servername\sharename

"servername" can be any computer on the network which is sharing a resource, in this case a printer. Since we're mapping printing, you can issue this command as follows:

NET USE LPT1 \\servername\sharedprinter

You can check the existing mappings by typing NET USE at the command prompt. Additionally, you can delete mappings using the following:

NET USE [devicename] /DELETE

If you wish a mapping to persist after logon/reboot, you can use the PERSISTENT keyword as follows:

NET USE LPT1 \\servername\sharedprinter /PERSISTENT:YES

To make this a little easier for you on a network, you can add the command syntax to your logon script. So, for example, you could have lines in logon.bat (or whatever the sript name) as follows:

NET USE LPT1 /DELETE
NET USE LPT1 \\servername\sharedprinter /PERSISTENT:YES

Then include the appropriate shared printer in the logon script for each group of users so that they can print to the correct network printer.

For the users, this is completely transparent: their applications will print to LPT1 and the output will be automatically routed to the network printer.

This solution works for -most- applications. Of course you will wish to try this first in a test environment.

Good luck, and post back to let us know how it goes!

Regards,

Daniel Mann
Terran Enterprises Corp
0
 
LVL 62

Expert Comment

by:☠ MASQ ☠
Comment Utility
Now that one I like!  (makes notes for future use) M :o)
0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
The printers are not shares, so I can't make it map back to itself.  Does anyone know how to share a printer or enable printer pooling from a batch file or VB Script?  They all have a printer with the same name and same port name, although the IP for that port will differ.
0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
Either option will work.  If printer pooling were enabled and the script could make it watch LPT1 as well as the IP address or if we can share the printer with a generic name, then we would be ready to go.  Is there any DOS command, VB Script, local or domain policy that be used to enable this?
0
 
LVL 38

Expert Comment

by:Herman D'Hondt
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ/Refund
Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

hdhondt
EE Cleanup Volunteer
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed, with points refunded (500)

modulo
Community Support Moderator
0
 

Expert Comment

by:kamyers1
Comment Utility
I'd just like to add that I need a solution to the same problem as the original poster, and that none of the answers provided so far fit the bill.  Key requirements: 1) The solution must redirect printing to the DEFAULT printer, whatever that happens to be on the specific machine in question.  2) It must NOT be necessary for the printer in question to be set up as a NETWORK or SHARED printer, even only on the specific machine itself.  I.e. it must work for USB or pure network printers (e.g. TCP/IP ports, not print servers on other machines) without being forced to define a new share.  3) The solution must NOT require specification of a specific printer name that might DIFFER on every machine where the solution is implemented.

s/KAM

0
 
LVL 7

Author Comment

by:ednetman
Comment Utility
I never was able to find a solution.  We have just been fixing them one at a time as they complain.  I fixed the image so that printer pooling is enabled on the printer that all users have.  It isn't the best solution, but what else can i do?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

When I recently replaced my image transfer kit on my office HP color laserjet 5550dn printer, I had a slight problem.  The left bracket that holds the transfer kit got stuck in the upright locked position instead of being at a 45 degree angle facing…
Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now