PDA

View Full Version : Mass Network Printer change (W2K)



g707
01-08-2003, 10:59 AM
I'm replacing our print server and need to update the client PCs to the new print server. Is there a way to check the clients (All are W2K Pro) to see what old printers they have installed and them update them accordingly?

Sudo-code snippet:

Set WshNetwork = WScript.CreateObject("WScript.Network")
‘Set oPrinters = WshNetwork.EnumPrinterConnections

‘Adds new printer by checking the old printers that have been previously installed:

If exist \\OldPrintSrv\OldPrinter1 then AddWindowsPrinterConnection \\NewPrintSrv\NewPrinter1

If exist \\OldPrintSrv\OldPrinter2 then AddWindowsPrinterConnection \\NewPrintSrv\NewPrinter2

Etc… Up to 40


‘Sets the new default printer depending on the old default printer:

If \\OldPrintSrv\OldPrinter1 is ‘default printer’ then WshNetwork.SetDefaultPrinter \\NewPrintSrv\NewPrinter1

If \\OldPrintSrv\OldPrinter2 is ‘default printer’ then WshNetwork.SetDefaultPrinter \\NewPrintSrv\NewPrinter2

Etc.. Up to 40


‘Removes old printer, if it exists:

WshNetwork.RemovePrinterConnection PrinterPath, true, true
wn.RemovePrinter "\\OldPrintSrv\OldPrinter1"

WshNetwork.RemovePrinterConnection PrinterPath, true, true
wn.RemovePrinter "\\OldPrintSrv\OldPrinter2"

Etc…Up to 40

This has probably already been asked but I can’t find it on the site, so any links would be appreciated. Thanks.

*******
* g707 *
*******