Solved

How do I print to a TCP/IP Printer from a MS DOS application accessed over a VPN

Posted on 2010-11-17
15
864 Views
Last Modified: 2013-12-15
We have a MS DOS based database application that is used frequently.  I work from a remote sales office, and need to access this database via VPN connection.  I have tried the
net use lpt2: \\{computername}\{printershare} to connect successfully.  However, I get the message that the printer cannot be accessed if a VPN connection is active.  Is there a way around this?
0
Comment
Question by:TridanSales
  • 4
  • 3
  • 3
  • +3
15 Comments
 
LVL 69

Expert Comment

by:Qlemo
ID: 34160354
Who or what is telling you that VPN and network printer do not work simultanously?
0
 
LVL 6

Expert Comment

by:ipajones
ID: 34160454
Some things to try:

When the VPN is connected do you have connectivity to the computer sharing the printer ?  i.e. can you ping this computername ?

You'll need to be authenticated against this computername what happens if you do "net use \\computername\ipc$"  ?

Is there an appropriate driver for this printer that is installed ?
0
 

Author Comment

by:TridanSales
ID: 34160522
The VPN message comes directly from Windows when I try to print.

I ran the net use \\computername\ipc$ command.  It completed successfully, but the DOS program says 1 page printed, but that is the extent of the action...
0
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.

 

Author Comment

by:TridanSales
ID: 34160533
Yes, I can ping the computer name.
0
 

Author Comment

by:TridanSales
ID: 34160540
There is no computer sharing the printer...  It is connected directly to the network, and each PC connects to it using a tcp/ip port.
0
 
LVL 77

Expert Comment

by:arnold
ID: 34160749
you my have to use the net use LPT1: \\server\printername

http://www.computing.net/answers/networking/printing-to-network-printer-in-dos/24488.html
0
 
LVL 77

Expert Comment

by:arnold
ID: 34160754
Oh, if you have a local LPT printer use LPT2 or higher as in the example on the link.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 34162165
Your own PC should have a printer share then, and the net use refers to your local share.
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 34162727
On the PC that has the printer connected, share the printer, eg as \\PCname\Dosprinter

Then, on the remote PC, type the following command from a DOS prompt:

NET USE LPT1: \\PCname\Dosprinter /PERSISTENT:Yes

Any printing to LPT1 on that PC will now go to the remote printer. If the DOS app does not use LPT1, substitute the correct port in the command. You may want to put the command in a login script.
0
 
LVL 16

Expert Comment

by:Spike99
ID: 34175072
How are you connecting to the remote DB, via a Remote Desktop Connection to a server?

If you are, you can map the LPT port to the local printer using the %clientname% variable so that you can print to it the using the DOS.  I got this to work using both a VPN and TSGateway connection to Server 2003 servers.

On the server, type this into a CMD prompt (I'm assuming the share name of the printer is DOSprinter).  The actual computer name doesn't matter with this variable:

        NET USE LPT1: \\%clientname%\DOSprinter

This works for me.  You can confirm it worked by typing in the command NET USE, which will give you all the network resources that are mapped (mapped printers, network drives, etc.).

In a DOS window on the server, you can test printing from the server by typing in this (substitute in the path of an actual TXT document, of course):

       PRINT C:\DOCUMENT.TXT

That did NOT work for me on Windows 2008, though. This did:

       TYPE C:\Document.txt > LPT1:

Please, let us know if this helps.

Alicia
0
 
LVL 16

Accepted Solution

by:
Spike99 earned 500 total points
ID: 34175283
NOTE: my previous post should work if you connect via RDP to a remote PC or server and you have the printer shared on the client PC, but it won't work if you are running the DOS program locally.

You can use the loop back IP address to map a printer shared on the same PC you are on:

      NET USE LPT1: \\127.0.0.1\DOSPRINTER

you log on to a remote server to run the DOS program or is it running locally? Is the printer connected to the PC you're on or some other PC or server?

Alicia
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 34184454
We should all learn to read properly. I just saw TridanSales's comment:

"There is no computer sharing the printer...  It is connected directly to the network"

First check that you can ping the printer. If you can, set up the printer under Windows as follows. Start the Add Printer wizard. Select to add a *local* printer (M$ has never learnt what a networked printer really is). When asked for the port to connect to, create a new Standard TCP/IP port with the printer's IP address. You can also give the port a name, or accept the default name. Click OK a couple of times to create the port, and finish printer installation. That should be it. If you still cannot print from Windows, make sure the VPN router is set to pass port 9100.

If you cannot ping the printer, check the settings on your router. The printer may be on a different subnet to which you don't have access remotely, but that can be fixed on the router.

After that is working, you still need to share the printer on the *local* PC and use the NET USE command.
0
 
LVL 69

Expert Comment

by:Qlemo
ID: 34184468
hdhondt,
That is exactly what I had in mind. The printer needs to be installed somehow on the local computer, and then shared. In fact, it just needs to be shared somewhere.
0
 
LVL 16

Expert Comment

by:Spike99
ID: 34199261
hdhondt:
I thought it was clear he had it shared somewhere because of the way he was trying to map LPT in his original post.  If the printer isn't actually shared on one of the PCs, then that is obviously a problem.

The exact command he could use to map LPT1 depends on whether or not he needs to map the "locally" installed printer shared on his own PC, a printer shared off another PC/server or his own shared printer redirected to a terminal server he's logged on to.

As I said, here are the commands that I would use to map the LPT port depending on where I was running the DOS program and where the printer is shared from:

Printer shared on local PC where DOS program is also being run:
   net use lpt1: \\127.0.0.1\sharename /persistent:yes

Printer shared on different PC or server when running DOS on local PC:
   net use lpt1: \\computername\sharename  /persistent:yes

Printer shared on local, client PC when running DOS on a remote server or PC:
   net use lpt1: \\%clientname%\sharename  /persistent:yes

NOTE:
%CLIENTNAME% is a system variable that should be typed just that way, it doesn't matter what the actual name of the client PC is.
0
 
LVL 16

Expert Comment

by:Spike99
ID: 34231865
TridanSales,

Has any of this helped you?  If it has, then that's great. If it hasn't, then let us know and maybe we could suggest something else.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Like many others, when I created a Windows 2008 RRAS VPN server, I connected via PPTP, and still do, but there are problems that can arise from solely using PPTP.  One particular problem was that the CFO of the company used a Virgin Broadband Wirele…
How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

810 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