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
858 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 68

Expert Comment

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

Expert Comment

by:ipajones
Comment Utility
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
Comment Utility
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
 

Author Comment

by:TridanSales
Comment Utility
Yes, I can ping the computer name.
0
 

Author Comment

by:TridanSales
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
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 76

Expert Comment

by:arnold
Comment Utility
Oh, if you have a local LPT printer use LPT2 or higher as in the example on the link.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 68

Expert Comment

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

Expert Comment

by:Herman D'Hondt
Comment Utility
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
Comment Utility
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
Comment Utility
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:Herman D'Hondt
Comment Utility
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 68

Expert Comment

by:Qlemo
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Juniper VPN devices are a popular alternative to using Cisco products. Last year I needed to set up an international site-to-site VPN over the Internet, but the client had high security requirements -- FIPS 140. What and Why of FIPS 140 Federa…
If you use NetMotion Mobility on your PC and plan to upgrade to Windows 10, it may not work unless you take these steps.
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…

772 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