Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Set Printer script failure

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,36846
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Set Printer script failure
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Set Printer script failure - 8/9/2006 1:28:49 AM   
  elrobobo

 

Posts: 2
Score: 0
Joined: 8/8/2006
Status: offline
Have a strange problem with a VBScript in some university computer labs that I administrate, and I don't know what's causing it.

When machines boot up and run a printer setting script, I get the following Windows Script Host error (on some machines, more on that in a sec):

Script: \. . . \setprinters.vbs
Line: 59
Char: 2
Error: The printer driver is unknown
Code: 80070705
Source: (null)

The biggest part of the problem for me is that the error doesn't happen with all the machines.

The computers in question are WindowsXP machines on a Samba domain. Our printing is done through Cups. We just installed a new model of printer in two of the labs (the only two that have the error), and set the drivers up to be shared from Samba (I am not sure how the admin who set up our last printers initially configured where the drivers were, since this was two admin generations back, before my time working in this office, and poorly documented.).

Here is the important part: all of the labs are on the same Symantec Ghost created image. Machines are given a name based on their lab, and shortcuts, desktops, printers, etc are assigned in log on scripts based on the name. Also, while we do used a few different models, all of are hardware is Dell, and all of it is exactly the same within a given lab. What this means is the only things that are different machine to machine are name and things having to do with the network connection (unless I have missed something).

However, after imaging an entire lab, and seemingly making all the machines essentially identical, some produce this error, and some of them work perfectly. The error is only consistant on the machines that produce it; i.e. computers labs23 and labs24 get the error every time they start up, while labs25 has worked every time.

The logical thing (I thought) to expect to be the most likely source of the error was a problem with a particular set of IPs. However, even after swaping network cables and manually assigning different IPs (normally these use DHCP) which were assigned to machines that had been working, the problem remained. So, essentially, everything but the MAC address has been swapped, yielding no results.

Beyond the networking settings, there shouldn't be any other differences machine to machine (except machine name, which never produced problems with this script before, or with any other part of our setup; I am going to play with this today though).

I'll also say that this is the same error that was produced before we properly added the drivers to the Samba share for printer drivers, and at that point it happened on all the machines

Here is the part of the script the error is coming from, and some context:

Sub SetPrinter(ByVal PrinterPath)
DIM WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection(PrinterPath) '<-This part isn't actually in the script; it's just that this is line 59, the line the error message sites
WshNetwork.SetDefaultPrinter Printerpath
End sub

I am not terribly skilled with VBScript, but I know this worked before, still works sometimes, and has no errors obvious to me.

Anyone have any ideas?
 
 
Post #: 1
 
 RE: Set Printer script failure - 8/9/2006 1:53:45 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
 ElRobobo,

What does the following var hold for info?

quote:

PrinterPath




_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to elrobobo)
 
 
Post #: 2
 
 RE: Set Printer script failure - 8/11/2006 12:25:12 AM   
  elrobobo

 

Posts: 2
Score: 0
Joined: 8/8/2006
Status: offline
The sub SetPrinter is called and passed a value consisting of the printer's ip and the name, in this syntax:

call SetPrinter("\\xxx.xxx.xxx.xxx\printer_name_in_cups")

It's conditionally called in several places within the script, based on the name of the machine.

Incidently, a way around this issue has been found. Since some machines did work, we could log on to the domain via one as the domain administrator and within Windows specify a driver for the installed printer. After that, when the script runs it lists the printer as (copy 1), but it works for all the machines in the lab. While this'll work, it doesn't explain why some worked before and some didn't. Does anyone have any ideas, incase this happens in other labs when I get to install new printers in them and none of them decide to work?

< Message edited by elrobobo -- 8/11/2006 12:30:13 AM >

(in reply to Snipah)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Set Printer script failure Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts