Riwe
(Fresh Scripter)
2004-06-24 12:58 PM
Citrix Printer

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


Kdyer
(KiX Supporter)
2004-06-24 02:06 PM
Re: Citrix Printer

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


Richard H.Administrator
(KiX Supporter)
2004-06-24 02:25 PM
Re: Citrix Printer

Quote:

thin client




...so no local printer configuration (other than LPT1 possibly)


Riwe
(Fresh Scripter)
2004-06-24 02:41 PM
Re: Citrix Printer

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


Richard H.Administrator
(KiX Supporter)
2004-06-24 03:10 PM
Re: Citrix Printer

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





Riwe
(Fresh Scripter)
2004-06-24 03:37 PM
Re: Citrix Printer

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


Richard H.Administrator
(KiX Supporter)
2004-06-24 05:10 PM
Re: Citrix Printer

Quote:

should I close every IF with and ENDIF



Yes.


Les
(KiX Master)
2004-06-24 05:24 PM
Re: Citrix Printer

See also the two FAQs
Why does the console display zeros and ones (amongst others)?

Is '?' a PRINT or NEWLINE command?