ShawnAdministrator
(KiX Supporter)
2003-05-20 08:04 PM
AddPrinterConnection to local printer

Got a bit of a tough one here, plus my hands are tied in terms of changing the existing login script. Scenario:

Each workstation in our domain has a machine variable that points to the print server and print share for that particular workstation. Its not important how we derive that variable, but for our purposes, lets call it $PRINTER and it would look like this:`

$PRINTER = "\\server\share"

well, our login script comes along and picks up this variable and uses it like this:

code:
If AddPrinterConnection($PRINTER)
; Show error
exit
EndIf

If SetDefaultPrinter($PRINTER)
; Show error
exit
EndIf

This logic works fine for remote printers. Even though the printer is already connected, etc ... the logic just goes past it and proceeds to set the printer as default. (By the way, we use roaming profiles so the need for this type of processing, people moving around and getting different maps based on where they are.

Now the problem, we're trying to integrate this environment to use LOCAL PRINTERS, printers simply connected to LPT1 ... and im banging my head against the wall trying to figure out how to make the login script work with this configuration. I definitely cannot change the login script - that is out of the question. So what im trying to do is somehow fake the AddPrinterConnection into working with the local printer.

I have already "shared-out" the local printer and used that name but I'm getting errors on that (error 123). I not sure if its possible to add a connection to a local printer share or not. So the logic im trying to use is:

$PRINTER = "\\@WKSTA\hpdeskjet"

$rs = AddPrinterConnection($PRINTER)

I dont even care if the AddPrinterConnection works, just want it to not error so that the login script will carry on to the SetDefaultPrinter. Might be screwed here. OS = NT. Kixvers = 3.54 (really old).


Sealeopard
(KiX Master)
2003-05-20 08:12 PM
Re: AddPrinterConnection to local printer

How about this. Create a shared printer on a central print server that points back to the local workstation's printers. Then connect the user to the appropriate printer on the print server, which point back to the user's workstation.

LonkeroAdministrator
(KiX Master Guru)
2003-05-20 08:13 PM
Re: AddPrinterConnection to local printer

shawn, make yourself being able to change the logonscript?

AllenAdministrator
(KiX Supporter)
2003-05-20 08:17 PM
Re: AddPrinterConnection to local printer

You might try my AddPrinter UDF as it supports all sorts of printers.

I'm surprised you cannot connect to a local printer share. I do this manually all the time for programs that do not recognize anything other than a lpt port.


ShawnAdministrator
(KiX Supporter)
2003-05-20 08:18 PM
Re: AddPrinterConnection to local printer

Can't change the login scripts (in the short to medium term) because of all the change management that has to occur (really). Cant set anything up on servers for the same reason. I thought that sharing out the local printer would have nailed it ... hmmm ... does that make sense ?

ShawnAdministrator
(KiX Supporter)
2003-05-20 08:21 PM
Re: AddPrinterConnection to local printer

hmmm, yeah - maybe I am setting-up the local print share wrong, but didn't think much could go wrong there. al, do you have any code special code snippets for this, or is the syntax same for local and remote ?

JochenAdministrator
(KiX Supporter)
2003-05-20 08:29 PM
Re: AddPrinterConnection to local printer

Now I am confused [Confused]

Who else is better to change a logon script than you ?
Oh well, the same story here, we use the same old script designed around 3.47, abused and raped by many since years ... I gave up in wanting to rewrite it about 2 years ago [Frown]

Ok, what is the OS of the machine you share the printer ?


Kdyer
(KiX Supporter)
2003-05-20 08:32 PM
Re: AddPrinterConnection to local printer

Shawn is in the same boat that I am in with regard to PCM (Production Change Management).. However, I have been given some flexibility to create a test environment (separate scripts) to test out new ideas and things.

Kent


LonkeroAdministrator
(KiX Master Guru)
2003-05-20 08:35 PM
Re: AddPrinterConnection to local printer

shawn, you can get yourself a new project or get job for summer assistant by insisting that it will be changed!

my whole career (not sure how many days it will continue) in current company I have been fighting against things I have suspicion about.

just got our company against Archhhserve and about 2 years ago got win9x removed as a start.

you just say that it's impossible. that is keyword to everything.
and as you are da man, they will believe you [Wink]


AllenAdministrator
(KiX Supporter)
2003-05-20 08:37 PM
Re: AddPrinterConnection to local printer

Man... and I thought my environment was bad. Once the corporate script finishes, I have complete control over the logon script at our facility (WOOHAHAHA...) [Wink]

If you are limited in how much you can change things, I don't think the addprinter UDF is the way to go, as it requires a bit more configuration than the simplier AddPrinterConnection. [Frown]


ShawnAdministrator
(KiX Supporter)
2003-05-20 08:38 PM
Re: AddPrinterConnection to local printer

Same here - I wrote our login scripts in 98/99 - and even though there has been many changes over the years, there never was a need to upgrade to the lastest and greatest (which we will be doing sometime later this year).

The problem is when you "hand-off" the scripts to the central admin types. A wall of change management is erected and you better have a darn good reason for wanting to change the script, or upgrading kix for that matter. Thousands of wkstns could be affected by some bad code.

To be honest - for our paranoid environment - im just warming-up to the idea that 4.21 is rock-stable enough to deploy in our environment. Especially given all the false starts from 4.02 to the present.


LonkeroAdministrator
(KiX Master Guru)
2003-05-20 08:58 PM
Re: AddPrinterConnection to local printer

shawn, dad...

actually you are best of telling them that there needs to be change as something is impossible.

then add to the paper what the benefits are also.

they will join their heads and come up with "ja, sure do it."

after that you have free hands on it but make it adaptable!
make it such that you have at least some sort of control over it even though it might require sub-domain scripts but believe me, it will be worth it.