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

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

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
TridanSales
Asked:
TridanSales
  • 4
  • 3
  • 3
  • +3
1 Solution
 
QlemoC++ DeveloperCommented:
Who or what is telling you that VPN and network printer do not work simultanously?
0
 
ipajonesCommented:
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
 
TridanSalesAuthor Commented:
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
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
TridanSalesAuthor Commented:
Yes, I can ping the computer name.
0
 
TridanSalesAuthor Commented:
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
 
arnoldCommented:
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
 
arnoldCommented:
Oh, if you have a local LPT printer use LPT2 or higher as in the example on the link.
0
 
QlemoC++ DeveloperCommented:
Your own PC should have a printer share then, and the net use refers to your local share.
0
 
hdhondtCommented:
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
 
Spike99On-Site IT TechnicianCommented:
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
 
Spike99On-Site IT TechnicianCommented:
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
 
hdhondtCommented:
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
 
QlemoC++ DeveloperCommented:
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
 
Spike99On-Site IT TechnicianCommented:
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
 
Spike99On-Site IT TechnicianCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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