Page 1 of 1 1
Topic Options
#202469 - 2011-06-18 11:44 AM Clientname Printer Mapping on Terminal Server
Bratenbengel Offline
Just in Town

Registered: 2010-07-05
Posts: 2
Loc: DE
Hello,
I have the problem that I did not get my printers mapped to %clientname%, when a client logs on the terminal server Win2003. Unfortunately, I was able to find any further help.

Workstation-printer.ini
 Code:
[Workstation1]
Printers=\\PSSERVER\Print1
Default=\\PSSERVER\Print2

[Workstation2]
Printers=\\PSSERVER\Print2;\\PSSERVER\Print-PDF
Default=\\PSSERVER\Print2


Workstation.kix
 Code:
$ID = Left (@WkSta, 12)
$PrinterList = Split(ReadProfileString('%logonserver%\NETLOGON\Wprinter.ini', $ID, 'Printers'), ';')
$DefPrinter  = ReadProfileString('%logonserver%\NETLOGON\Wprinter.ini', $ID, 'Default')
For Each $Printer in $PrinterList
  AddPrinterConnection($Printer)
Next
SetDefaultPrinter($DefPrinter)


How can I retrieve the %clientname% and then work through the appropriate ini file? With the workstation works fine.I hope you can help me.

This Host : %CLIENTNAME% ???

cu Bratenbengel


Edited by Bratenbengel (2011-06-18 11:55 AM)
_________________________
cu Bratenbengel

Top
#202470 - 2011-06-18 02:17 PM Re: Clientname Printer Mapping on Terminal Server [Re: Bratenbengel]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
You can use environmental vars right in kix.

For example
 Code:
? %clientname%


There is probably a better way, as I don't use Citrix, but here is my stab using the Sessiontype UDF...

untested
 Code:
$ID=iif(sessiontype="Citrix ICA session",%clientname%,@wksta)


SessionType() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=195471#Post195471

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
_________________________
(... better days ahead)

Top
#206539 - 2013-01-09 10:07 AM Re: Clientname Printer Mapping on Terminal Server [Re: Bratenbengel]
Bratenbengel Offline
Just in Town

Registered: 2010-07-05
Posts: 2
Loc: DE
How the process can be to written to log file?

 Code:
 
$ID = left ("%ClientName%", 15)
$PrinterList = Split(ReadProfileString('%logonserver%\NETLOGON\PRINTER\Drucker-ThinClient.ini', $ID, 'Drucker'), ';')
$DefPrinter  = ReadProfileString('%logonserver%\NETLOGON\PRINTER\ThinClient.ini', $ID, 'Standard')
For Each $Printer in $PrinterList
  AddPrinterConnection($Printer)
Next
SetDefaultPrinter($DefPrinter)
_________________________
cu Bratenbengel

Top
#206540 - 2013-01-09 10:13 AM Re: Clientname Printer Mapping on Terminal Server [Re: Bratenbengel]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Have a look at the Open(), Writeline() and Close() functions. They can be used to open a file, write to it and close it.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#206541 - 2013-01-09 11:51 AM Re: Clientname Printer Mapping on Terminal Server [Re: Mart]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
You can also use RedirectOutput.
Top
#206542 - 2013-01-09 02:22 PM Re: Clientname Printer Mapping on Terminal Server [Re: BradV]
Valentim Offline
Fresh Scripter

Registered: 2010-01-04
Posts: 46
Loc: Brazil, PE, Recife
Hello Bratenbengel,

If you want to use my printer mapping, it is operating normally here in the company.

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Main=26647&Number=197326#Post197326


Edited by Valentim (2013-01-09 02:23 PM)
_________________________

Top
#206543 - 2013-01-09 04:28 PM Re: Clientname Printer Mapping on Terminal Server [Re: Valentim]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I would also recommend placing a variable in front of the AddPrinterConnection and SetDefaultPrinter functions. This will catch the return codes of the functions preventing them from displaying 1's and 0's in a console.

 Code:
$ID = left ("%ClientName%", 15)
$PrinterList = Split(ReadProfileString('%logonserver%\NETLOGON\PRINTER\Drucker-ThinClient.ini', $ID, 'Drucker'), ';')
$DefPrinter = ReadProfileString('%logonserver%\NETLOGON\PRINTER\ThinClient.ini', $ID, 'Standard')
For Each $Printer in $PrinterList
  $rc = AddPrinterConnection($Printer)
Next
$rc = SetDefaultPrinter($DefPrinter)

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 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.03 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