Announcement

Collapse
No announcement yet.

Printer.mapping.based.on.computer.group.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printer.mapping.based.on.computer.group.

    Hi,

    Situation:

    Windows2003 domain, XP clients and I have 10 computer labs.
    The way I name the computers in each lab is:
    Lab01-01, Lab01-02, Lab01-03...

    Lab02-01, Lab02-02, Lab02-03...
    ...
    Lab10-01, Lab10-02, Lab10-03...

    I have an OU (computer acct ) for each computer lab
    OU: Lab01,.Lab02...Lab10.
    Each lab has one printer. I'd like to run vbscript to map the printer for user
    based on which lab that they are in.

    Please help. Thanks!

    P.S

    This is what I learn from Mark Minasi book but it doesn't apply to my situation. It only applies for couple of computers

    Option Explicit

    Dim oNetwork, sPrintPath

    Set oNetwork = CreateObject("WScript.Network")

    Select Case oNetwork.ComputerName

    Case "pc01"
    sPrintPath = "\\printsvr\printer1"

    Case " pc02"
    sPrintPath = "\\printsvr\printer2"
    End Select

    oNetwork.AddWindowsPrinterConnection sPrintPath
    oNetwork.SetDefaultPrinter sPrintPath
    Set oNetwork = vbEmpty
    Set sPrintPath = vbEmpty
    Teamwork

  • #2
    hey

    Ok add to login script or GPO this script

    Name each printer printerXX

    where XX define number of printer ( 01,02,03..)

    and add this small and simple script :

    Code:
    Set objNetwork = Wscript.CreateObject("Wscript.Network")
    
    sPrintPath = "\\printsvr\printer"  & Mid(objNetwork.ComputerName ,4, 2)
    
    objNetwork.AddWindowsPrinterConnection sPrintPath 
    objNetwork.SetDefaultPrinter sPrintPath 
    
    Set oNetwork = vbEmpty 
    Set sPrintPath = vbEmpty

    Enjoy !

    Comment

    Working...
    X