Script to map shared printer

By v_2chpin ·
I have a printer installed on a Win 2003 server which is acting as a file and print server. The client machines are in a workgroup as of now and the printer is shared out and mapped to all of them. Almost everyday the printer looses its connection and has to be remapped on most of the client machines. The clients are running Win XP SP2.

I was wondering if anyone can help me with a script which I can keep on the users' desktops as a cmd or a bat file and have the users run it to map the printer whenever they face this problem. I found a couple of scripts on the internet but none of them worked for me. Any help is greatly appreciated.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by ben.rattigan In reply to Script to map shared prin ...

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
Set net = CreateObject("WScript.Network")
net.AddWindowsPrinterConnection "\\<servername>\<printersharename>", "<printer_description>"
wshShell.Run "net use lpt1: \\<servername>\<printersharename>"

Related Discussions

Related Forums