#202469 - 2011-06-18 11:44 AM
Clientname Printer Mapping on Terminal Server
|
Bratenbengel
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
[Workstation1]
Printers=\\PSSERVER\Print1
Default=\\PSSERVER\Print2
[Workstation2]
Printers=\\PSSERVER\Print2;\\PSSERVER\Print-PDF
Default=\\PSSERVER\Print2
Workstation.kix
$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
|
|
|
|
#206539 - 2013-01-09 10:07 AM
Re: Clientname Printer Mapping on Terminal Server
[Re: Bratenbengel]
|
Bratenbengel
Just in Town
Registered: 2010-07-05
Posts: 2
Loc: DE
|
How the process can be to written to log file?
$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
|
|
|
|
#206541 - 2013-01-09 11:51 AM
Re: Clientname Printer Mapping on Terminal Server
[Re: Mart]
|
BradV
Seasoned Scripter
  
Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
|
You can also use RedirectOutput.
|
|
Top
|
|
|
|
#206543 - 2013-01-09 04:28 PM
Re: Clientname Printer Mapping on Terminal Server
[Re: Valentim]
|
ShaneEP
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.
$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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2312 anonymous users online.
|
|
|