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 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