C
Cary Shultz
Scott,-----Original Message-----
How to add multiple printers using AD/OU/Computers using a vbscript?
I have successfully implemented a automatically installed single printer
(default) based on AD/OU/Users using Microsoft KB 263226.
I however can not get the same script to run based on AD/OU/Computer. Why
will it not work based on computer?
Based on the assumption that it will only work on Users, how can I use a
vbscript to add multiple printers using either AD/OU/Users?
NOTE: I have tried to simply add the additional printers without
success...e.g.
Set WshNetwork = CreateObject("WScript.Network")
PrinterPath = "\\Server\Printer"
PrinterDriver = "PrinterDriver"
PrinterPath2 = "\\Server\Printer2"
PrinterDriver2 = "PrinterDriver2"
WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver
WshNetwork.AddWindowsPrinterConnection PrinterPath2, PrinterDriver2
WshNetwork.SetDefaultPrinter "\\Server\Printer"
Thanks for any help.
Scott
.
I am realtively new to vbs scripting ( finally breaking
away from .bat and .cmd! ) but will try my best.
It looks like you are following one of the scripts via the
Script Center ( or whatever it is called - have not had
the time in the last three weeks to go back there ).
Here is how I would write it using the script "format"
that you are using and then one that I have used a few
times with success:
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("Wscript.Network")
Printerpath = "\\Server\printer"
WshNetwork.AddWindowsPrinterConnection PrinterPath
Here is the one that I have used before:
Dim net
Set net = CreateObject("Wscript.Network")
net.RemoveNetworkDrive "O:"
net.MapNetworkDrive "O:", "\\server\sharename","False"
net.RemoveNetworkDrive "P:"
net.MapNetworkDrive "P:", "\\server\sharename","False"
net.AddWindowsPrinterConnection "\\server\printshare1"
net.AddWindowsPrinterConnection "\\server\printshare2"
net.AddWindowsPrinterConnection "\\server\printshare3"
net.SetDefaultPrinter "\\server\printshare2"
I have included in the example some mapped network drives
as well as three printers, setting the second printer as
the default printer. It is important to include
the "false" at the end of the network drive mappings,
otherwise the second, third and each subsequent time the
users logon they will get an error message. It
essentially says "this is not a persistent mapping".
I would call this logon.vbs and use Group Policy as a
logon script and apply it to the OU which contains the
user accounts to which you want this logon script
applied. It works very very well with WIN2000 and WINXP
clients.
HTH,
Cary