Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Change Scripting Newbie Help

Status
Not open for further replies.

kendaukcat

IS-IT--Management
Sep 13, 2001
46
Hello Gang.

I am new to scripting, and am trying to move user printer mappings from a failing server to another by use of a VBS script. I have already installed the printers on the new server, and have written the following script:

Set WSHNetwork = CreateObject("WScript.Network")

'Remove Old Printers
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\AD_DJ970"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\AD_HP5Si"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\FD_LJ5Si"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\HPDJ500"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\LinePrin"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\M-HP4000"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\PDDJ5850"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\PDHP990"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\PDLJ4200"
WSHNetwork.RemoveWindowsPrinterConnection "\\gts0004\Print54"

'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\AD_DJ970"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\AD_HP5Si"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\FD_LJ5Si"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\HPDJ500"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\LinePrin"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\M-HP4000"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\PDDJ5850"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\PDHP990"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\PDLJ4200"
WSHNetwork.AddWindowsPrinterConnection "\\gts0005\Print54"
Network.SetDefaultPrinter "\\gts0005\AD_HP5Si"

However, I get the folowing error when it runs from the WSH:

Script: c:\documents and settings\adminsitrator\print.vbs
line: 4
Char: 1
Error: Object doesn't support this property or method: 'WSHNetwork.RemoveWindowsPrinterConnection'
Code 800a01b6
Source: Microsoft VBScript runtime error.

I am sure is is something really small that I am missing...any imput would be greatly appreciated.

Thanks in Advance,

Ken
 
I find it difficult to believe that no one has run into this issue before...where is the love?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top