Page 1 of 1 1
Topic Options
#133750 - 2005-02-14 07:34 PM DelPrinterConection - Installs Drivers if Printer Not There
JackDobiash Offline
Lurker

Registered: 2005-02-14
Posts: 3
Loc: Grand Ronde, OR
Greetings! I have a question regarding the DelPrinterConnection function. It works fine to remove the printers, but I have found out that if the printer it is trying to remove is not already installed on their workstation, it Installs the driver. This is causing some issues, including slowing the machine down on login (at least the first time) since it's copying 30+ printer drivers onto their computers. Is there anyway to prevent this from happening, or a way to check to see if it is installed first before trying to remove it? Thanks!
Top
#133751 - 2005-02-15 12:51 AM Re: DelPrinterConection - Installs Drivers if Printer Not There
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Don't remove printers that are not already connected. And see the UDF forum for UDFs that delete printers.
_________________________
There are two types of vessels, submarines and targets.

Top
#133752 - 2005-02-15 02:32 AM Re: DelPrinterConection - Installs Drivers if Printer Not There
JackDobiash Offline
Lurker

Registered: 2005-02-14
Posts: 3
Loc: Grand Ronde, OR
I found a workaround. Someone made a UDF which checks to see if the printer exists, so I just slimmed it down for my specific environment:

Function DeletePrinter($_Pri)
If Len(ReadValue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices",$_Pri)) DelPrinterConnection($_Pri)
endif
endfunction

Thanks!

Top
#133753 - 2005-02-15 04:04 AM Re: DelPrinterConection - Installs Drivers if Printer Not There
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
someone eh!.. without looking up the code, my guess it was Lonkero
Top
#133754 - 2005-02-15 04:12 AM Re: DelPrinterConection - Installs Drivers if Printer Not There
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
With the use of a varname like $_Pri, unless the code was delonked, there is no way it could be his.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#133755 - 2005-02-15 08:52 AM Re: DelPrinterConection - Installs Drivers if Printer Not There
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
One thing about driver removal.. You could use the following code. It is more or less a proof of concept and probably needs to be tuned a bit.. If memory serves, the idea comes from how to remove print drivers for NT4.

Delete/Refresh Print Drivers

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#133756 - 2005-02-15 05:49 PM Re: DelPrinterConection - Installs Drivers if Printer Not There
JackDobiash Offline
Lurker

Registered: 2005-02-14
Posts: 3
Loc: Grand Ronde, OR
Quote:

someone eh!.. without looking up the code, my guess it was Lonkero




Yeah, it was from Function PriMapState by Lonkero. I didn't need the stuff regarding Win9x and also didn't need to know if it was the Default printer, and didn't need to check if it was in Windows since it's ran through GPO. All it does now is just check to see if the printer is already installed before attemping to delete it.

The only drawback is, you can't use the sharename of the printer, you have to put its FULL name in, since that is how it is stored in the Registry.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 580 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.054 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org