PDA

Click to See Complete Forum and Search --> : WSHNetwork.AddWindowsPrinterConnection and Windows 95


kenfranklin
Feb 1st, 2001, 05:28 PM
My company is wanting to migrate several hundred printer queues from one server to another and I've been asked to automate this task with Windows Script Host. This seems to be a fairly easy task on NT or 2000 workstations but the majority of our PC's are still Windows 95.

I've managed to get my script to find which queues are currently installed, grab the printer's name and driver but when I try to add the queue on the new server, I'm told the printer already exists. It does, kind of, but not on the same server. The possibilites I see are to delete or rename the old printe queue or to give the new queue a different name, but I can't figure out how to do any of this.

Here is the line of code I'm using to attempt to migrate these printers:

WSHNetwork.AddWindowsPrinterConnection NewServerName+printername(i), PrinterDriver

I've also tried

WSHNetwork.AddWindowsPrinterConnection NewServerName+printername(i), PrinterDriver, newunc+printername(i)

If I rename the old printer and hardcode the PrinterDriver variable, I am able to add a printer. If I hardcode the PrinterDriver variable without renaming the old printer, I come up with the same 'printer already exists' error.

I'd prefer to write this in WSH but I could use a Visual Basic solution if that is all that is available. Has anyone ever done this successfully?

Clunietp
Feb 1st, 2001, 10:57 PM
Why don't you try using RemovePrinterConnection before you try adding the printer connection of the same name?