Discussion Locked

network printer script

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I would like to write a vb script that would map a networked printer. I am using a windows 2000 client and windows NT Server. Any help or online resources would be greately apreciated.

4 replies

by ewgny

Look at these resources
http://www.rlmueller.net/products.htm
Also newsgroups
Microsoft.public.windows.server.scripting
Microsoft.public.scripting.wsh
Microsoft.public.vbscript.wsh

Here is an example:

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server\AdminLaser
WshNetwork.SetDefaultPrinter "\\server\AdminLaser"

by yoram

if you want to run it in VB:

Set WshNetwork = WScript.CreateObject("WScript.Network")
PrinterPath = "\\servername\printername"
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath

and if you are ok with command line you can alos create a batch file with the following:

rundll32 printui.dll,PrintUIEntry /in /u /z /n\\servername\printername
rundll32 printui.dll,PrintUIEntry /y /n\\servername\printername

The first command maps the printer and the second makes it default. You need to split this because otherwise your computer might attempt to make the printer default before it maps and give you an error.

This discussion is closed to new replies.