Discussion Locked

Mapping network printer with script?

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have tried many ways to map a network printer by using script. So far, I still fail to do so. Either the script has syntax error or the printer isn't mapped despite the command was successful. Can somebody out there kind enough to tell me theirsuccessful stories? Thank you.

8 replies

by stillatit

This is done with a net use command.

net use LPT1: \\servername\printername

If there is already something attached to LPT1, this will fail. To delete the previous definition, use

net use LPT1: /delete

Note also that printers with long names, or with strange characters in their names, will not work. The printer name should be limited to 15 characters, and should have no special characters in it (e.g., & $ * and so on).

You can test your commands from a command window to make surethey work.

Good luck.

by mini-rex

Thanks for your reply Stillatit. I have tried the same exact syntax, it will return will command successful, but when I check my printer applet, there is no printer mapped. Also, when I try printing something, NT will complain there is no printer attached. Just wondering, does it matter if the shared printers are not physically hooked up to the server. Thank you once again.

by sdbytnar

Try creating a printer that connects to lpt1 using the appropriate printer driver. Then try running the script again. When you print to the local printer on lpt1 the job should be redirected to the network.

Sean

by pezzz

There is a utility called con2prt.exe. It allows you to install the printer in a script... con2prt \\server\printer I believe. After you do that then you can use the net use command if you need to tell it to use an lpt port.

This discussion is closed to new replies.