[Samba] roaming profiles ok, but what about the printers?

Daniel Ramaley daniel.ramaley at DRAKE.EDU
Mon Aug 30 21:14:17 GMT 2004


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



More information about the samba mailing list