BarryWhite
(Fresh Scripter)
2005-11-22 10:20 PM
setting default printer to workstation

Hello all,
I'm having a problem creating a default printer for a workstation that is a local printer to another workstation.
I've tried using the @userid as well as the @wrksta, but the printer does not install.
Is this correct?

if @WKSTA = Workstation7
AddPrinterConnection ("\\Workstation8\hp LaserJet 1000")
SetDefaultPrinter ("\\Workstation8\hp LaserJet 1000")
? "Added printer connection...."
Endif

Thanks


Howard Bullock
(KiX Supporter)
2005-11-22 10:28 PM
Re: setting default printer to workstation

What exactly is the problem?

When using an IF construct, you should also use the ELSE for debugging to see if your IF is being evaluated as you expect. You also should evalute the return code from ADDPRINTERCONNECTION. See the documentation for details. SETDEFAULTPRINTER also returns the errcode of the operation. You evalute it also. See the example in the docs.

Workstation7 should have quotes around it.


BarryWhite
(Fresh Scripter)
2005-11-22 11:24 PM
Re: setting default printer to workstation

Thanks for the response Howard,
The problem is that the printer does not create..
I have used the same code for a user and it works ok.
Can anyone recommend a good (easy to read) kix book?


LonkeroAdministrator
(KiX Master Guru)
2005-11-22 11:49 PM
Re: setting default printer to workstation

think this might be the easiest:
http://www.amazon.com/exec/obidos/tg/detail/-/B0000W86HC/102-4286701-6303356?v=glance


Les
(KiX Master)
2005-11-23 12:25 AM
Re: setting default printer to workstation

First off, can yuou connect to the printer by browsing to it?

LonkeroAdministrator
(KiX Master Guru)
2005-11-23 01:23 AM
Re: setting default printer to workstation

and secondly first off, what's the printer's share name.

Les
(KiX Master)
2005-11-23 01:25 AM
Re: setting default printer to workstation

Hey, I was getting to the second (share) part.

BarryWhite
(Fresh Scripter)
2005-11-23 08:35 AM
Re: setting default printer to workstation

I can browse and connect to it no problem,
The share name is hp Laserjet 1000 which is the same as the printer name.
I have exactly the same script for another user and they connect fine.
Thanks


Richard H.Administrator
(KiX Supporter)
2005-11-23 10:14 AM
Re: setting default printer to workstation

Have you checked the event logs on the machine in question? Perhaps the user is not able to update the printer drivers on the local machine.

Check the return value (or @ERROR) after calling the functions. If there is an error then display it. If the success of a function or command is important to you then you must check the status and react accordingly.