Page 1 of 1 1
Topic Options
#204554 - 2012-03-23 10:28 PM delprinterConnection ......Help
Chan Offline
Fresh Scripter

Registered: 2011-10-14
Posts: 15
Loc: Arizona
Hello all it been a while.. be rackuing my self

I need to delet a few printer via login scrip... the printer have been deleted off our seerver and do not want user trying to print to them. as you can see this can cause phone calls... I can not see why the code is not removing the Key this is on xp, and 7

script below
;********************************************************************************
;* subroutine to delete OLD printer
;**************************************************************************

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,Cannon IR3300 (Copy Room East)=0
$temp=Delprinterconnections("\\xxxxxxx,IR3300 (Copy Room East)")
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,Cannon IR5050 (Copy Room East)") =0
$temp=Delprinterconnections("\\xxxxxxx,Cannon IR5050 (Copy Room East)")
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,HP 4Plus (IDF East)") =0
$temp=Delprinterconnections("\\xxxxxxx,HP 4Plus (IDF East)")
endif

Top
#204556 - 2012-03-23 11:08 PM Re: delprinterConnection ......Help [Re: Chan]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Do you have a UDF called DelPrinterConnections in your script? The built in function is without the s.

You might also look at PrinterConnection() to help you find and remove printers rather than use the Registry. PrinterConnection allows you to use the share name for both finding if it is installed, and to remove it. See the examples in the header.

PrinterConnection() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=203840#Post203840

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

Top
#204557 - 2012-03-23 11:14 PM Re: delprinterConnection ......Help [Re: Chan]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
The KiXtart function to delete a printer is
DelPrinterConnection
Without s

Top
#204558 - 2012-03-23 11:16 PM Re: delprinterConnection ......Help [Re: Witto]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
5 minutes and 47 seconds too late. I am getting old...
Top
#204559 - 2012-03-24 04:19 AM Re: delprinterConnection ......Help [Re: Witto]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I would also like to point that the original poster did miss a quote. and something else. on the very first line.
_________________________
!

download KiXnet

Top
#204561 - 2012-03-24 03:21 PM Re: delprinterConnection ......Help [Re: Lonkero]
Chan Offline
Fresh Scripter

Registered: 2011-10-14
Posts: 15
Loc: Arizona
yes that was my typo here is the full code corrected.. i basically is looking to do this in the simplist way . for it will only be active when i need to delet or remove a printer from end users machine

;********************************************************************************
;* subroutine to delete OLD printer
;**************************************************************************

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,Cannon IR3300 (Copy Room East")=0
$temp=Delprinterconnection("\\xxxxxxx,IR3300 (Copy Room East)")
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,Cannon IR5050 (Copy Room East)") =0
$temp=Delprinterconnection("\\xxxxxxx,Cannon IR5050 (Copy Room East)")
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,HP 4Plus (IDF East)") =0
$temp=Delprinterconnection("\\xxxxxxx,HP 4Plus (IDF East)")
endif

Top
#204563 - 2012-03-24 03:50 PM Re: delprinterConnection ......Help [Re: Lonkero]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
 Originally Posted By: Lonkero
I would also like to point that the original poster did miss a quote. and something else. on the very first line.
and a closing parens.

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,xxxxxxx,Cannon IR3300 (Copy Room East)")=0
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#204564 - 2012-03-24 04:13 PM Re: delprinterConnection ......Help [Re: Les]
Chan Offline
Fresh Scripter

Registered: 2011-10-14
Posts: 15
Loc: Arizona
thanks another typo i caught that right after i posted this but test are still the same with printer connection not being deletd.....o the joy of saturday work
Top
#204567 - 2012-03-24 09:45 PM Re: delprinterConnection ......Help [Re: Chan]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you are testing if the printer is there and only if it is not, do delprinterconnection()
_________________________
!

download KiXnet

Top
#204569 - 2012-03-24 10:40 PM Re: delprinterConnection ......Help [Re: Lonkero]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... ExistKey() has been deprecated long ago. ISTR its logic was the reverse to KeyExist().

As for DelPrinterConnection(), I don't know if you can use a comma to separate server from printer. I think it should be \\server\printer.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#204570 - 2012-03-24 11:18 PM Re: delprinterConnection ......Help [Re: Lonkero]
Chan Offline
Fresh Scripter

Registered: 2011-10-14
Posts: 15
Loc: Arizona
Ok .. so this is where we are and what i am working with.. i have been gevin teh task of getting this to work win xp win 7 enviroment run kix 4.61 teh Idea is something that we can add to in future since later this year we plaine on up gradding 75 printer in one weekend ....... o not looking forward to that.

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,server1,Cannon IR3300 (Copy Room East)") = 0

? "Deleting Cannon IR3300 (Copy Room East) printer"
$temp=delprinterconnection("\\serever1,Cannon IR5050 (Copy Room East)")
? "Cannon IR3300 (Copy Room East) printer deleted"
else
? "Cannon IR3300 (Copy Room East) printer already deleted."
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,Server1,Cannon IR5050 (Copy Room East)") = 0

? "Deleting Cannon IR5050 (Copy Room East) printer"
$temp=delprinterconnection("\\Server1,cannon IR5050 (Copy Room East)")
? "Cannon IR5050 (Copy Room East) printer deleted"
else
? "Cannon IR5050 (Copy Room East) printer already deleted."
endif

if existkey("HKEY_CURRENT_USER\Printers\Connections\,,Server1,HP4Plus (IDF East)") = 0

? "Deleting HP4Plus (Copy Room East) printer"
$temp=delprinterconnection("\\Server1,HP4Plus (IDF East)")
? "HP4Plus (IDF East) printer deleted"
else
? "HP4Plus (IDF East) printer already deleted."
endif

Top
#204571 - 2012-03-25 12:29 AM Re: delprinterConnection ......Help [Re: Chan]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, so you ignored my comment about the format using comma versus hack... whatever.

Are you sure about your spelling? "Canon" or "Cannon"? "HP 4Plus" or "HP4Plus"
Are you using printer name or share name?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#204572 - 2012-03-25 12:59 AM Re: delprinterConnection ......Help [Re: Les]
Chan Offline
Fresh Scripter

Registered: 2011-10-14
Posts: 15
Loc: Arizona
I just read that thank you for that catch yes it will need the wak"\" as for the speeling the names have all been changes as i do not wat to post anyof that on the web in my scrip it is currect.... Will update my scrip in a few hours and test... But i tink the Wak wehre the issue... will reply after test
Top
#204573 - 2012-03-25 01:17 AM Re: delprinterConnection ......Help [Re: Chan]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
We know a \ to be a hack, sometimes called a backwhack. http://en.wikipedia.org/wiki/Backslash

A whack is a forward slash /.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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
1 registered (mole) and 494 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.066 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

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