Page 1 of 1 1
Topic Options
#4293 - 2000-10-03 06:57 AM ADDPRINTERCONNECTION QUESTION
Anonymous
Unregistered


USING: NT print server and all NT workstations

When using the addprinterconnection command in a script that runs everytime a user logs in, does it mean that it will install those printer drivers everytime the scripts is ran over and over again?? Wouldn't this slow the performance down. And if so, is there a way to just install those printers for certain groups only ONCE and not do it again the next time the script runs??
I appreciate any help.

Thanks

Top
#4294 - 2000-10-04 09:06 PM Re: ADDPRINTERCONNECTION QUESTION
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
see mine answer a the kixtart scripts site.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#4295 - 2002-07-30 12:45 AM Re: ADDPRINTERCONNECTION QUESTION
Anonymous
Unregistered


I came up with this on my own, and im sure someone could make it alot tighter. I am submitting it to give you some ideas. Works only with NT and 2000 clients.

code:
 

;------------------------
; MAP PRINTERS
;------------------------

$PRINTERC01 = "\\CROM2\3rd"
$PRINTERC02 = "\\CROM2\Canon 330PS 3rd view"
$PRINTERC03 = "\\CROM2\Canon 6th PS"
$PRINTERC04 = "\\CROM2\6TH"
$PRINTERV01 = "\\vicpa01\3rd"
$PRINTERV02 = "\\VICPS01\VICCANONIR330VIEW3"
$PRINTERV03 = "\\VICPS01\VICCANONIR330VIEW6"
$PRINTERV04 = "\\VICPS01\VICCANONIR330YATES3"
$PRINTERV05 = "\\VICPS01\VICCANONIR330YATES4"
$PRINTERV06 = "\\VICPS01\VICLEXT612BIOMETRY"
$PRINTERV07 = "\\VICPS01\VICLEXT612PCLACCT"
$PRINTERV08 = "\\VICPS01\VICLEXT612PSACCT"

$PV01 = "0"
$PV02 = "0"
$PV03 = "0"
$PV04 = "0"
$PV05 = "0"
$PV06 = "0"
$PV07 = "0"
$PV08 = "0"

$DPV01 = "CANNON IR330 PCL 3RD FLOOR VIEW STREET"
$DPV02 = "CANNON IR330 PS 3RD FLOOR VIEW STREET"
$DPV03 = "CANNON IR330 PS 6th FLOOR VIEW STREET"
$DPV04 = "CANNON IR330 PS 3RD FLOOR YATES STREET"
$DPV05 = "CANNON IR330 PS 4TH FLOOR YATES STREET"
$DPV06 = "LEXMARK T612 3RD FLOOR VIEW - BIOMETRY"
$DPV07 = "LEXMARK T612 4TH FLOOR VIEW - ACCOUNTING"
$DPV08 = "LEXMARK T612 4TH FLOOR VIEW - ACCOUNTING"

; IF @INWIN = "2"
; $OS = "9X"
; ENDIF

;------------------------




;------------------------
;Builds list of installed printers and writes to c:\printers.txt - for each user.
;------------------------

Break ON
$Key = "HKEY_CURRENT_USER\Printers\Connections"
$prt_log = "C:\Printers.txt"

Del $prt_log

$SubKey = EnumKey( $Key , 0 )
$INDEX = 0
While @ERROR = 0
$wrk = SubStr($Subkey,3,30)
$comma = InStr($wrk,",")
$svrend = $comma - 1
$prtsrt = $comma + 1
$svr = Rtrim(SubStr($wrk,1,$svrend))
$prt = Rtrim(SubStr($wrk,$prtsrt,20))
$uncname = "\\"+$svr+"\"+$prt
$rc = Open(1,$prt_log,5)
$rc = WriteLine(1,$uncname+Chr(13)+Chr(10))
$rc = Close(1)
$INDEX = $INDEX + 1
$SubKey = EnumKey( $Key ,$INDEX)
Loop
$Total_printers = $INDEX - 1
? "Written "+$Total_printers+" entries to "+$prt_log ?

;------------------------




;------------------------
; Search c:\printners.txt for printer and set on-off value for each printer.
;------------------------

$file = "c:\printers.txt"

If Open(1,$file) = "0"
$string = "" + $PRINTERV01
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV01 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV02
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV02 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV03
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV03 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV04
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV04 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV05
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV05 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV06
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV06 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV07
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV07 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

If Open(1,$file) = "0"
$string = "" + $PRINTERV08
$line = ReadLine(1)
While @error = "0"
If InStr($line,$string)
$PV08 = "1"
EndIf
$line = ReadLine(1)
Loop
$q=Close(1)
EndIf

;------------------------




;------------------------
; MAP PRINTERS:
;------------------------
; CHECK FOR PRINTER GROUP MEMBERSHIP
; IF OK, CHECK FOR PRINTER MAP
; IF EXIST, SKIP, IF NOT EXIST, MAP
;------------------------
; To be used with location groups - to identify location of user.
;------------------------


; MAPS PRINTERS FOR ALL USERS

;For Win98 and NT users, use..

If InGroup("6th Floor View")
If $PV03 = "0"
If AddPrinterConnection ("" + $PRINTERV03) = "0"
? "ADDED PRINTER: "+ $DPV03
EndIf
EndIf

If $PV07 = "0"
If AddPrinterConnection ("" + $PRINTERV07) = "0"
? "ADDED PRINTER: "+ $DPV07
EndIf
EndIf

EndIf


If InGroup("3rd Floor View")

If $PV01 = "0"
If AddPrinterConnection ("" +$PRINTERV01) = "0"
? "ADDED PRINTER: "+ $DPV01
EndIf
EndIf

If $PV02 = "0"
If AddPrinterConnection ("" + $PRINTERv02) = "0"
? "ADDED PRINTER: "+ $DPV02
EndIf
EndIf

If PV06 = "0"
If AddPrinterConnection ("" + $PRINTERv06) = "0"
? "ADDED PRINTER: "+ $DPV06
EndIf
EndIf
EndIf


If InGroup("4th Floor Yates")

If $PV05 = "0"
If AddPrinterConnection ("" + $PRINTERV05) = "0"
? "ADDED PRINTER: "+ $DPV05
EndIf
EndIf
EndIf


If InGroup("3rd Floor Yates")

If $PV04 = "0"
If AddPrinterConnection ("" + $PRINTERV04) = "0"
? "ADDED PRINTER: "+ $DPV04
EndIf
EndIf
EndIf


If InGroup("Vic Acct")

If $PV07 = "0"
If AddPrinterConnection ("" + $PRINTERV07) = "0"
? "ADDED PRINTER: "+ $DPV07
EndIf
EndIf

If $PV08 = "0"
If AddPrinterConnection ("" + $PRINTERV08) = "0"
? "ADDED PRINTER: "+ $DPV08
EndIf
EndIf
EndIf

?

Return
end

works for me.

Top
#4296 - 2002-07-30 12:55 AM Re: ADDPRINTERCONNECTION QUESTION
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also Yet Another MapPrinter function
_________________________
There are two types of vessels, submarines and targets.

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 1336 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 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