Page 1 of 1 1
Topic Options
#121768 - 2004-06-24 12:58 PM Citrix Printer
Riwe Offline
Fresh Scripter

Registered: 2004-06-24
Posts: 5
HI!
Im 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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#121770 - 2004-06-24 02:25 PM Re: Citrix Printer
Richard H. Administrator Offline
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 Offline
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, Im trying to move all the different script in one kix file, I dont want to use vbscript anymore.

/Riwe

Top
#121772 - 2004-06-24 03:10 PM Re: Citrix Printer
Richard H. Administrator Offline
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 Offline
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 Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

should I close every IF with and ENDIF



Yes.

Top
#121775 - 2004-06-24 05:24 PM Re: Citrix Printer
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
See also the two FAQs
Why does the console display zeros and ones (amongst others)?

Is '?' a PRINT or NEWLINE command?
_________________________
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
0 registered and 310 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.048 seconds in which 0.027 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