#121768 - 2004-06-24 12:58 PM
Citrix Printer
|
Riwe
Fresh Scripter
Registered: 2004-06-24
Posts: 5
|
HI! I´m trying to make a script that maps printers to a thin client and the script should assign printers based on the computer names, the 6 first charachter in the name. The script should map a couple of printers and make one of them the default printer. Does anyone have a good example? I have about 60 printers that need to be mapped. Thanks in advance Riwe
|
Top
|
|
|
|
#121769 - 2004-06-24 02:06 PM
Re: Citrix Printer
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Can I ask a question? Why? Why do you need to map/re-map a printer? If you can capture the client printer to LPT1, MetaFrame picks up the client printer fine.
We use printers this way with no problem..
The other things is if you clean out the cleint profiles from the servers in your farm using DELPROF or other means, these would have to be re-built at each server,
Thanks,
Kent
|
Top
|
|
|
|
#121770 - 2004-06-24 02:25 PM
Re: Citrix Printer
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
thin client
...so no local printer configuration (other than LPT1 possibly)
|
Top
|
|
|
|
#121771 - 2004-06-24 02:41 PM
Re: Citrix Printer
|
Riwe
Fresh Scripter
Registered: 2004-06-24
Posts: 5
|
Because all our printers are network printers, and all our clients are using thinstation linux dist. Today all printers get mapped by a vbscript, I´m trying to move all the different script in one kix file, I don´t want to use vbscript anymore.
/Riwe
|
Top
|
|
|
|
#121772 - 2004-06-24 03:10 PM
Re: Citrix Printer
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Assuming the computer names come though as something like: "SITE01-0001" "SITE01-0002" "SITE23-0982"
Create an INI file on your netlogon share like this: Code:
[SITE01] laserjet=1 colourlaser=1 [SITE02] colourlaser=1
...and so on.
Now in your script you can (untested!): Code:
For Each $sPrinter in Split(ReadProfileString("%LOGONSERVER%\netlogon\printers.ini",Left(%CLIENTNAME%,6),""),Chr(10)) If $sPrinter ...map printer here... EndIf Next
|
Top
|
|
|
|
#121773 - 2004-06-24 03:37 PM
Re: Citrix Printer
|
Riwe
Fresh Scripter
Registered: 2004-06-24
Posts: 5
|
Thanks four replays.
I tried this and it worked, now is my question is this code good?
Whats the difference between
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
AND
ADDPRINTERCONNECTION ("\\w2k3dc\hpl4")
?
should I close every IF with and ENDIF eg.
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
ENDIF
IF ADDPRINTERCONNECTION ...
Script:
;Delete all existing networkprinters
DelTree("HKEY_CURRENT_USER\Printers\Connections")
AddKey("HKEY_CURRENT_USER\Printers\Connections")
;Check location depending on clientname
$Datornamn = LEFT(%clientname%,6)
;Connect the right printer to this terminal
SELECT
CASE ($Datornamn = TSPS18)
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
IF ADDPRINTERCONNECTION ("\\w2k3dc\hp") =0
? "Printer added"
IF SETDEFAULTPRINTER ("\\w2k3dc\hp") =0
? "Default printer"
CASE 1
$Selection = MessageBox("Clientname unknown. No printer connections available at this moment. Please contact you system administrator.", "Printerinfo", 64)
IF $Selection = 1
EXIT
ENDIF
ENDSELECT
Edited by Riwe (2004-06-24 03:38 PM)
|
Top
|
|
|
|
#121774 - 2004-06-24 05:10 PM
Re: Citrix Printer
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
should I close every IF with and ENDIF
Yes.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|