Andreas Paulick
2004-Aug-30 15:08 UTC
[Samba] roaming profiles ok, but what about the printers?
Hi there, We have a little intranetwork with Samba 3.0.x as PDC. There are 20 Win2k-clients in several rooms and 18 users roaming from one machine to another (according to their tasks). So any user has a roaming profile. This runs almost perfect (some minor problems are still there, but the the advantages are overwelming). But there is one thing, I can't understand. Why does Win2k saves the printer information (esp. the default printer) in the user area of the registry? All my users want to print on the nearest printer they can reach. In any room is a laser printer, every printer has a build-in print-server. If a user logs on to a machine in a room, they want to use the printer in this room as default. They havent an most beloved default printer, that they uses whereever they are. But unfortunately this is the behavior of Win2k. A user keep the printer he chooses as the default printer, no matter which client he uses. Sure its easy to change the default printer in the printer wizard, but we have some Software, that doesn't recognize this (esp. UPS Wordship). I found this Idea: network-wide there will be known only 3 Printers: -Laser printer -Laser printer tray #2 (for heading printed paper) -Label printer These are printer queues at the Samba-server running CUPS. A print to this queue will be redirected to the approriate printer, depending on the IP of the printing client. So a print to the laser printer from any client of room #A will be printed at the laser printer in room#A without hassle with printer settings at the client. I think of a custom print command with %I and a table to translate IP vs. real printer. But my bash skills are limited. But i don't know how to do this. I believe there are other admins out there with the same problem. How have you solved this? thanks in advantage Andy Paulick
Daniel Ramaley
2004-Aug-30 21:14 UTC
[Samba] roaming profiles ok, but what about the printers?
Another way to do what you want is to create a logon script that sets the printer based on the name of the computer. I do that for a couple labs that i administer where students use roaming profiles. I have a logon.bat that is set by active directory group policy to run whenever someone logs in. It sounds like you aren't using active directory, but you could probably just put the script in everyone's startup directory. Here are the relevant lines from logon.bat: :configScript cScript.exe //Nologo \\My-File-Server\public\logon.vbs This just runs a .vbs file. logon.vbs looks like this: ##### BEGIN FILE ##### ' ********************************************************************** ' Assign default printer based on the computer's name. ' ********************************************************************** Option Explicit Dim WshNetwork, ComputerName, ShortName ' Get the computer's name. Set WshNetwork = WScript.CreateObject("WScript.Network") ComputerName = LCase(WshNetwork.ComputerName) ShortName = Left(ComputerName, 10) Select Case ShortName Case "cowl-labpc" WshNetwork.SetDefaultPrinter "Lab Printer" Case "cowl-podpc" WshNetwork.SetDefaultPrinter "Pod Printer" Case "cowl-temp" WshNetwork.SetDefaultPrinter "Pod Printer" Case Else WScript.Echo "Problem determining PC location." End Select ##### END FILE ##### I am not a visual basic expert; i copied this from somewhere else which i've since forgotten. But basically it looks at the first few characters of the name and sets a printer based on that. You could make the case statement as long as necessary with one case for each machine if you had to. Maintaining such a script will be a slight pain, but probably easier than your first idea. On Monday 30 August 2004 10:15 am, Andreas Paulick wrote:>Hi there, > >We have a little intranetwork with Samba 3.0.x as PDC. There are 20 >Win2k-clients in several rooms and 18 users roaming from one machine > to another (according to their tasks). So any user has a roaming > profile. This runs almost perfect (some minor problems are still > there, but the the advantages are overwelming). >But there is one thing, I can't understand. Why does Win2k saves the >printer information (esp. the default printer) in the user area of the >registry? All my users want to print on the nearest printer they can >reach. In any room is a laser printer, every printer has a build-in >print-server. If a user logs on to a machine in a room, they want to > use the printer in this room as default. >They havent an most beloved default printer, that they uses whereever >they are. But unfortunately this is the behavior of Win2k. A user keep >the printer he chooses as the default printer, no matter which client > he uses. >Sure its easy to change the default printer in the printer wizard, but >we have some Software, that doesn't recognize this (esp. UPS > Wordship). I found this Idea: network-wide there will be known only 3 > Printers: -Laser printer >-Laser printer tray #2 (for heading printed paper) >-Label printer >These are printer queues at the Samba-server running CUPS. >A print to this queue will be redirected to the approriate printer, >depending on the IP of the printing client. So a print to the laser >printer from any client of room #A will be printed at the laser > printer in room#A without hassle with printer settings at the client. > I think of a custom print command with %I and a table to translate IP > vs. real printer. But my bash skills are limited. > >But i don't know how to do this. I believe there are other admins out >there with the same problem. >How have you solved this? > >thanks in advantage >Andy Paulick-- ------------------------------------------------------------------------ Dan Ramaley Digital Media Library Specialist (515) 271-1934 Cowles Library 140, Drake University
Andreas Paulick
2004-Sep-04 10:17 UTC
[Samba] roaming profiles ok, but what about the printers?
I've got some inspirations from the archive of lists.samba.org and I'm writing a little shell-wrapper around the print-command. Because I have'nt access to the server right now I write this from memory: smb.conf: --------snip-------- [printers] Browseable = no #don't show the real printers [laser] printeable = yes print command = script.sh laser %s %m %u [laser2] printeable = yes print command = script.sh laser2 %s %m %u [color] printeable = yes print command = script.sh color %s %m %u --------snap-------- The printshares are only for smb.conf There are no such printers called LASER, LASER2 oder COLOR. on this Server. It's "virtual Printers" like sambafax the shell-wrapper script.sh: --------snip-------- #!/bin/bash #4 Parameter: $1-$4. giving to the script at calling time #$1 = which Share used #$2 = spool-file in /var/temp = datas to pPrint #$3 = netbiosname of the calling client #$4 = User cause $3 in client01 ) cause $1 in laser ) lpr -d hplj2300 $2 ;; laser2 ) lpr -d kyo3800 $2 ;; Color ) lpr -d canoni960 $2 ;; esac client02 ) cause $1 in laser ) lpr -d kyo3800 $2 ;; laser2 ) lpr -d hplj2300 $2 ;; Color ) lpr -d canoni960 $2 ;; esac client03 ) cause $1 in laser ) lpr -d hplj6 $2 ;; laser2 ) lpr -d hplj6 $2 ;; Color ) lpr -d Minolta3100 $2 ;; esac esac --------snap-------- All printers in the lpr-command must be exist. The clients only sees the 3 Printer LASER, LASER2 and COLOR and use them with generic postscript-driver. At the samba server runs also a printserver and it cares via ghostscript about the translation to the the printer. New Printers will be installed only at the linux-server, the name will written in the script.sh and 'done'. No changes necessary at the Clients. So easy can also substituted a printer :) I have to optimise and test this etc. then should it running. B.t.w.: which generic windows-printerdriver would you suggest? Maybe 'Apple Laserwriter 600 PS' or 'HP Laserjet PS' ? Or use you the vendor windows-printerdriver and print at rawdriver on linux-side? greetings Andy P.
Andreas Paulick
2004-Sep-04 10:19 UTC
[Samba] roaming profiles ok, but what about the printers?
I've got some inspirations from the archive of lists.samba.org and I'm writing a little shell-wrapper around the print-command. Because I have'nt access to the server right now I write this from memory: smb.conf: --------snip-------- [printers] Browseable = no #don't show the real printers [laser] printeable = yes print command = script.sh laser %s %m %u [laser2] printeable = yes print command = script.sh laser2 %s %m %u [color] printeable = yes print command = script.sh color %s %m %u --------snap-------- The printshares are only for smb.conf There are no such printers called LASER, LASER2 oder COLOR. on this Server. It's "virtual Printers" like sambafax the shell-wrapper script.sh: --------snip-------- #!/bin/bash #4 Parameter: $1-$4. giving to the script at calling time #$1 = which Share used #$2 = spool-file in /var/temp = datas to pPrint #$3 = netbiosname of the calling client #$4 = User cause $3 in client01 ) cause $1 in laser ) lpr -d hplj2300 $2 ;; laser2 ) lpr -d kyo3800 $2 ;; Color ) lpr -d canoni960 $2 ;; esac client02 ) cause $1 in laser ) lpr -d kyo3800 $2 ;; laser2 ) lpr -d hplj2300 $2 ;; Color ) lpr -d canoni960 $2 ;; esac client03 ) cause $1 in laser ) lpr -d hplj6 $2 ;; laser2 ) lpr -d hplj6 $2 ;; Color ) lpr -d Minolta3100 $2 ;; esac esac --------snap-------- All printers in the lpr-command must be exist. The clients only sees the 3 Printer LASER, LASER2 and COLOR and use them with generic postscript-driver. At the samba server runs also a printserver and it cares via ghostscript about the translation to the the printer. New Printers will be installed only at the linux-server, the name will written in the script.sh and 'done'. No changes necessary at the Clients. So easy can also substituted a printer :) I have to optimise and test this etc. then should it running. B.t.w.: which generic windows-printerdriver would you suggest? Maybe 'Apple Laserwriter 600 PS' or 'HP Laserjet PS' ? Or use you the vendor windows-printerdriver and print at rawdriver on linux-side? greetings Andy P.