Page 1 of 1 1
Topic Options
#203128 - 2011-09-22 06:46 PM Delete existing printers before adding new ones
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
I know this is an easy question for most here: How do I delete a print queue? I am moving the management of a network printer from one print server to another. My current script for assigning a printer is as follows:

 Code:
IF @UserID = "FDUser"
	If AddPrinterConnection ("\\printsvr1\FDUpstairsEMS") = 0
		? "Added printer connection...."
	EndIf
EndIf


I would like to replace the "\\printsvr1\FDUpstairsEMS" with "\\printsvr2\FDUpstairsEMS"

Thank you kindly \:\)
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

Top
#203130 - 2011-09-22 11:41 PM Re: Delete existing printers before adding new ones [Re: StarwarsKid]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4563
Loc: USA
I used primapstate along with addprinterconnection and delprinterconnection

Here is an example:

 Code:
? "Adding Printers"
if not primapstate("\\server1\draft")
  $rc=addprinterconnection("\\server1\draft")
endif
if not primapstate("\\server1\bond")
  $rc=addprinterconnection("\\server1\bond")
endif

? "Removing Old Printers"
if primapstate("\\server1\letters")
  $RC=delprinterconnection("\\server1\letters")
endif
if primapstate("\\server1\documents")
  $RC=delprinterconnection("\\server1\documents")
endif
if primapstate("\\server\hpletters")
  $RC=delprinterconnection("\\server\hpletters")
endif
if primapstate("\\server\hpdocuments")
  $RC=delprinterconnection("\\server\hpdocuments")
endif
if primapstate("\\server\lmdocuments")
  $RC=delprinterconnection("\\server\lmdocuments")
endif


PriMapState() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=83306#Post83306

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
#203137 - 2011-09-23 11:56 PM Re: Delete existing printers before adding new ones [Re: Allen]
StarwarsKid Offline
Seasoned Scripter
*****

Registered: 2005-06-15
Posts: 506
Loc: Oregon, USA
Thanks Allen. That will help a lot.

Regards,

Matthew
_________________________
let the wise listen and add to their learning,
and let the discerning get guidance- Proverbs 1:5

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 1441 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.052 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