+ Post New Thread
Results 1 to 4 of 4
Network and Classroom Management Thread, Assinging printers to clients based on OU in Technical; OK hello and everything. I would like to be able to map printers to certain computers based on their department ...
  1. #1
    originofsymmetry's Avatar
    Join Date
    Jun 2007
    Posts
    184
    Thank Post
    9
    Thanked 13 Times in 11 Posts
    Rep Power
    16

    Assinging printers to clients based on OU

    OK hello and everything. I would like to be able to map printers to certain computers based on their department which is an OU in AD, e.g english
    Here is the script I have at present and it isn't quite coming off how I'd prefer. What is it thats going wrong?

    PS. I'm actually a student who is interested in networks and this is a wee server I set up at home to mimic the one at my school.
    I've got profiles, shares and re-directed desktops all sorted and working, but I for the life of me, can not get this script to pull off.
    So I can give details here:

    Servername:jonnyserv
    OU'sublic
    neo
    DM

    Code:
    set objSysInfo = CreateObject("ADSystemInfo")
    strComputerDN = lcase(objSysInfo.ComputerName)
    intStart=InStr(strComputerDN,"ou=")
    if intStart <> 0 then 
        intEnd=InStr(intStart,strComputerDN,",")
    
        strOU = mid(strComputerDN,intStart,intEnd)
    
        Set objNetwork= CreateObject("WScript.Network")
    
        select case lcase(strOU)
            case "ou=public"
                objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 1"
                objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 2"
                objNewwork.SetDefaultPrinter "\\jonnyserv\hp 2000c 1"
            case "ou=neo"
                objNetwork.AddWindowsPrinterConnect "\\jonnyserv\hp 2000c 3"
                objNewwork.SetDefaultPrinter "\\jonnyserv\hp 2000c 3"
        end select
    end if
    But its acting rather awkwardly, in that only some usuers actualy recieve the printers, another gets hp 2000c 1+2 when they should only recieve 3, and most get nothing, and another gets hp 2000c3 wherever they go.

    Could it also be down to me using preconfigured profiles, I ave done those with all users but kept the .dat extension so settings are saved, would changing it to .man and apply that then remove the printers from the profile at logoff as .man doesnt save settings.In other words, the printers are sticking to the users profile.
    I made a new user with no pre-configured profile and it only recieves hp 2000c 1+2 regardless of which PC they log into

    Hope this all makes sense thnx

  2. #2

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,582
    Thank Post
    107
    Thanked 761 Times in 592 Posts
    Rep Power
    179

    Re: Assinging printers to clients based on OU

    If you do a search there are member-contributed scripts that do just this. You might find it easy to use one of these than troubleshoot your existing one.

    It is also worth removing any existing printers at logon, before the assignment of the new ones... that is what other people tend to do - I use a script tat selects the printer in a case statement because OUs are not a suitable way for selecting printers for me.

  3. #3
    OutLawTorn's Avatar
    Join Date
    Jul 2007
    Location
    Sydney, Australia
    Posts
    214
    Thank Post
    8
    Thanked 7 Times in 7 Posts
    Rep Power
    31

    Re: Assinging printers to clients based on OU

    Windows 2003 Server R2 has printer installation via group policy. It doesn't handle setting default printers very well (no way of setting it within group policy, so it just picks the last printer on the PC (alphabetically)). It can also have some problems for users in mutiple groups.

    More information can be found here.

  4. #4
    mullet_man's Avatar
    Join Date
    Oct 2005
    Location
    Oldham
    Posts
    726
    Thank Post
    34
    Thanked 46 Times in 45 Posts
    Rep Power
    26

    Re: Assinging printers to clients based on OU

    I would use Ric_'s script mate, link to thread below.

    http://www.edugeek.net/index.php?nam...iewtopic&t=404

    Its really easy to setup, you can setup defaults, and its easily changed if a printer goes down etc.

    Not had any problems with missing printers or wrong defaults. Thanks Ric_

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 50
    Last Post: 19th May 2008, 12:24 PM
  2. Clients Not Seeing RIS
    By thegrassisgreener in forum Windows
    Replies: 7
    Last Post: 22nd November 2007, 03:16 PM
  3. Mapping Printers based on Location
    By NeoNemesis in forum Windows
    Replies: 11
    Last Post: 6th August 2007, 08:03 AM
  4. Citrix PS 4.0 thin clients and printers
    By triggmiester in forum Thin Client and Virtual Machines
    Replies: 5
    Last Post: 11th July 2007, 03:26 PM
  5. Setting Printers Based On Room Location
    By ICTNUT in forum Scripts
    Replies: 34
    Last Post: 13th May 2006, 08:19 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •