jbmoberly76
IS-IT--Management
I need help setting up default printers. I have used Mark D. MacLachlan's script as a template and it works great for nearly all my needs. My script connects users to network printers and sets the preferred network printer as the default. However, I have a couple of users who have local printers that they want to keep as defaults. I found a post from a couple of weeks ago that addresses this issue, but the script isn't working for me, and I'm not sure why. I would appreciate any help I can get!
Here is the portion of the script in question:
(the last section that addresses local printers is the only part that doesn't seem to work)
============================================================
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P1", "5P1"
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P2", "5P2"
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P3", "5P3"
WSHNetwork.AddWindowsPrinterConnection "\\DC\Canon2200-PCL", "Canon 2200-PCL"
WSHNetwork.AddWindowsPrinterConnection "\\DC\Canon5000-PCL6", "Canon 5000-PCL"
WSHNetwork.SetDefaultPrinter "\\DC\5P3"
Next
'Enumerate printers and set local printer as default
'Warning: If user has more than one local printer
' then the last one detected will be default
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) <> "\\" Then
WSHNetwork.SetDefaultPrinter WSHPrinters.Item(LOOP_COUNTER +1),True,True
End If
Next
============================================================
thanks in advance for your assistance
Joe
Here is the portion of the script in question:
(the last section that addresses local printers is the only part that doesn't seem to work)
============================================================
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P1", "5P1"
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P2", "5P2"
WSHNetwork.AddWindowsPrinterConnection "\\DC\5P3", "5P3"
WSHNetwork.AddWindowsPrinterConnection "\\DC\Canon2200-PCL", "Canon 2200-PCL"
WSHNetwork.AddWindowsPrinterConnection "\\DC\Canon5000-PCL6", "Canon 5000-PCL"
WSHNetwork.SetDefaultPrinter "\\DC\5P3"
Next
'Enumerate printers and set local printer as default
'Warning: If user has more than one local printer
' then the last one detected will be default
Set WSHPrinters = WSHNetwork.EnumPrinterConnections
For LOOP_COUNTER = 0 To WSHPrinters.Count - 1 Step 2
If Left(WSHPrinters.Item(LOOP_COUNTER +1),2) <> "\\" Then
WSHNetwork.SetDefaultPrinter WSHPrinters.Item(LOOP_COUNTER +1),True,True
End If
Next
============================================================
thanks in advance for your assistance
Joe