Adding printers to multiple users

  • Thread starter Thread starter letmeoutofhere
  • Start date Start date
L

letmeoutofhere

Hi

i have an AD of around 400 computers, separated into a few different
departments. a directive has come down from head office that all the
printer names have to be renamed to a particular way. i do not want to have
to go round every single PC to re-add the printers!

i have tried renaming the sharename of a certain printer on the server and
hoping that a PC *picks* it up on reboot. it turns out that doesn't work!

i hope i have explained myself!

what would be the best way to tackle this problem without having to go round
to every PC?

Thanks in Advance

Shaun
 
bummer!

thanks anyway (i think!)

Paul Bergson said:
Get on your walking shoes. You will have to visit each machine.

--

Paul Bergson MCT, MCSE, MCSA, CNE, CNA, CCA

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Add something to your logon script to the effect of:

-----------------start script-------------------------
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections

For i = 0 to oPrinters.Count - 1 Step 2
WScript.Echo "Checking: " & oPrinters.Item(i+1)

If UCase(oPrinters.Item(i+1)) = "\\TDFP01\BSM1" Then
WshNetwork.RemovePrinterConnection "\\TDFP01\BSM1",True,True
WshNetwork.AddWindowsPrinterConnection "\\ccps01\WGBSM1", True,True
End If

If UCase(oPrinters.Item(i+1)) = "\\TDFP01\BSM2" Then
WshNetwork.RemovePrinterConnection "\\TDFP01\BSM2",True,True
WshNetwork.AddWindowsPrinterConnection "\\ccps01\WGBSM2", True,True
End If

If UCase(oPrinters.Item(i+1)) = "\\TDFP01\TCI_Admin1" Then
WshNetwork.RemovePrinterConnection "\\TDFP01\TCI_Admin1",True,True
WshNetwork.AddWindowsPrinterConnection "\\ccps01\WGTCI_Admin1", True,True
End If

Next
----------------end script----------------------
and check out part of this - merge the needed pieces with the above script,
and add to logon script:

----------------start script-----------------------
Dim strComputer, sPrinterPath, sPrinterName, sDefaultPrinter, sOldPrntSrv,
sNewPrntSrv

sOldPrntSrv = "<oldprintserver>"
sNewPrntSrv = "<newprintserver>"

Set WshNetwork = CreateObject("WScript.Network")

'Grab the old print info, set the printer name as a variable
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer")
For Each objPrinter in colInstalledPrinters
sPrinterPath = objPrinter.Name
If Instr(sPrinterPath, sOldPrntSrv) Then
Length = Len(sPrinterPath)
sPrinterName = Right(sPrinterPath,Length - InStrRev(sPrinterPath,"\"))

'See if it is the default printer; if so, set a variable to use for the
replacement
If objPrinter.Default = True Then
sDefaultPrinter = sPrinterName
End If

'Delete the old printer connection

WshNetwork.RemovePrinterConnection "\\" & sOldPrntSrv & "\" & sPrinterName

'Create the new printer with the same printer name

WshNetwork.AddWindowsPrinterConnection "\\" & sNewPrntSrv & "\" &
sPrinterName

End If
Next

'Set the new default printer

WshNetwork.SetDefaultPrinter "\\" & sNewPrntSrv & "\" & sDefaultPrinter
-----------------end script--------------------------
 
Back
Top