I am running a Server 2003 and Win XP network, for a school, and we
used to use BAT files on the client machines to specify printers for
each PC depending on their room. However I am now trying to move all of
this over to vbs scripts applied by group policies to the machines.
I have set up OU's in active directory for each of our computer labs,
and have placed the PC's from each lab in those OU's. I am then
appllying the script qouted below, to the "user configuration \ windows
settings \ scripts \ Logon" part of a Group Policy to each computer lab
OU.
If i run the script locally on a PC it works fine, but it will not set
the printer for me when I log on to a machine. Any ideas as to what I
am doing wrong would be great.
-------------------------------------------------------------------------------------------------------
set wshNetwork = CreateObject ("WScript.Network")
'deletes all network printers
Set clPrinters = WshNetwork.EnumPrinterConnections
On Error Resume Next
For i = 0 to clPrinters.Count - 1 Step 2
wshNetwork.RemovePrinterConnection clPrinters.Item(i+1), true
Next
On Error Goto 0
'maps new printers.
wshNetwork.AddWindowsPrinterConnection "\\print\H11Print"
'sets default printer.
wshNetwork.SetDefaultPrinter "\\print\H11Print"
------------------------------------------------------------------------------------------------------