+ Post New Thread
Results 1 to 13 of 13
Windows Thread, Printers - adding them to machines by group policy? in Technical; Hi, Does anyone know a way of doing this? I currently add them to all users on a computer by ...
  1. #1

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Printers - adding them to machines by group policy?

    Hi,

    Does anyone know a way of doing this? I currently add them to all users on a computer by using the "rundll32 printui.dll,PrintUIEntry /ga /n" command, which works fine but isn't the worlds most managable solution!

    I'll be separating the computers into OUs over the summer break and was wondering if there's a way of adding printers from our print server to each OU and setting the default printer.

    Possible?

  2. #2
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    119

    Re: Printers - adding them to machines by group policy?

    Take a look in the scripts section and at the myriad of printer login scripts there.

    Not sure if someone has attached the UserinOU() function to it but you should be able to find a script with that in... It's used to determine if a user is in a particular OU and you can then set the default printer using that.

    I have something similar setup on my own setup.

  3. #3

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,087
    Thank Post
    210
    Thanked 432 Times in 312 Posts
    Rep Power
    145

    Re: Printers - adding them to machines by group policy?

    On Server 2003 R2 you can actually deploy printers using group policy its self. If you don't have that, then try this handy VB script it's what I use and it works well and reliably, it reads the OU name and maps printers accordingly.

    Code:
    on error resume next
    Set objWshNetwork = CreateObject("WScript.Network")
    
    Set objAdsSystemInfo = CreateObject("adsysteminfo")
    Set objComputerName = GetObject("LDAP://" & objAdsSystemInfo.ComputerName)
    Set objOU = GetObject(objComputerName.Parent)
    strOU = replace(objOU.Name,"OU=","")
    
    Select Case strOU
      Case "228"
     objWshNetwork.AddWindowsPrinterConnection "\\STORAGE\228-bw$"
     objWshNetwork.SetDefaultPrinter "\\STORAGE\228-BW$"
     objWshNetwork.AddWindowsPrinterConnection "\\STORAGE\228-colour$"
    
    Case "staffroom"
     objWshNetwork.AddWindowsPrinterConnection "\\STORAGE\staffroom$"
     objWshNetwork.SetDefaultPrinter "\\STORAGE\staffroom$"
    End Select
    This is an example, the one I use in practice has over 40 entries.

  4. #4

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Printers - adding them to machines by group policy?

    Oooh that looks pretty nice Maniac cheers. I'm fumbling through the scripts section at the moment but most seem pretty specific for each site the person is working at!

  5. #5
    tarquel's Avatar
    Join Date
    Jun 2005
    Location
    Powys, Mid-Wales, UK
    Posts
    1,740
    Thank Post
    13
    Thanked 45 Times in 35 Posts
    Rep Power
    30

    Re: Printers - adding them to machines by group policy?

    Still using a simple kixtart for printers...

    no reason to change from it [yet].

    Nath

  6. #6
    Chad's Avatar
    Join Date
    May 2007
    Location
    Elgin
    Posts
    74
    Thank Post
    5
    Thanked 20 Times in 19 Posts
    Rep Power
    19

    Re: Printers - adding them to machines by group policy?

    We use Kixtart too, and deploy printers based on the PC name.

    I created a script that reads a printers.ini file, this is just plain text so it's very easy for those in the department without scripting skills to edit/add/remove printers.

  7. #7
    Oops_my_bad's Avatar
    Join Date
    Jan 2007
    Location
    Man chest hair
    Posts
    1,738
    Thank Post
    438
    Thanked 53 Times in 50 Posts
    Rep Power
    31

    Re: Printers - adding them to machines by group policy?

    I'm sure you can deploy printers via GP in the normal 2003 release as well? It's just that in R2 you get a nicer interface to do it

  8. #8

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Printers - adding them to machines by group policy?

    Quote Originally Posted by TeddyKGB
    I'm sure you can deploy printers via GP in the normal 2003 release as well? It's just that in R2 you get a nicer interface to do it
    Any online resources that tell me how to do it without R2?

    So far i've found plenty sites stating how to do it with R2 but none without :?

  9. #9

    Join Date
    Jul 2006
    Location
    London
    Posts
    2,963
    Thank Post
    160
    Thanked 153 Times in 117 Posts
    Rep Power
    50

    Re: Printers - adding them to machines by group policy?

    You cant do it without R2

    Even if you have got it, I really recommened you dont use it. It seems great at first but as soon as you come to a point where you want to remove printers you have to do it exactly in the way MS wants or it is a nightmare. Im sure others can back me up on this

    Ive recently started using an almost identical script to maniacs, and it works like a dream

  10. #10
    tarquel's Avatar
    Join Date
    Jun 2005
    Location
    Powys, Mid-Wales, UK
    Posts
    1,740
    Thank Post
    13
    Thanked 45 Times in 35 Posts
    Rep Power
    30

    Re: Printers - adding them to machines by group policy?

    Quote Originally Posted by TeddyKGB
    I'm sure you can deploy printers via GP in the normal 2003 release as well? It's just that in R2 you get a nicer interface to do it
    It was a new feature in 2003 R2. so no, it wasn't possible previously.

    Nath.

  11. #11
    Oops_my_bad's Avatar
    Join Date
    Jan 2007
    Location
    Man chest hair
    Posts
    1,738
    Thank Post
    438
    Thanked 53 Times in 50 Posts
    Rep Power
    31

    Re: Printers - adding them to machines by group policy?

    Ah OK.. I thought there was a "deployed printers" at the highest node in a GP even in the initial release of 2003. Must just be an R2 thing.

    BTW sidewinder - if I want to remove a printer I just undeploy it GP and it uninstalls it off the workstation at next refresh *smug*

  12. #12

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Printers - adding them to machines by group policy?

    Hi all,

    Using Maniacs script (as it seems fairly straight forward) although I've run into some minor problems!

    I've edited and added the script to my machine group OU to run at machine startup (in this case IT1).

    I'm getting no error messages but at the same time I'm getting no printers added.

    Is there anyway to ensure the script is running? the gpresult says it is but as nothing is happening I'm a little confused.

    Script is below:
    -----------------------------
    on error resume next
    Set objWshNetwork = CreateObject("WScript.Network")

    Set objAdsSystemInfo = CreateObject("adsysteminfo")
    Set objComputerName = GetObject("LDAP://" & objAdsSystemInfo.ComputerName)
    Set objOU = GetObject(objComputerName.Parent)
    strOU = replace(objOU.Name,"OU=","")

    Select Case strOU
    Case "IT1"
    objWshNetwork.AddWindowsPrinterConnection "\\print\Dell1700 IT1"
    objWshNetwork.SetDefaultPrinter "\\PRINT\Dell1700 IT1"
    objWshNetwork.AddWindowsPrinterConnection "\\print\HP2500C IT1"

    End Select
    -----------------------------
    What I was wondering if we need a $ after the share name or if the Case "IT1" should have the parent container in it so it'd be "Workstations,IT1"

    Any suggestions? I have the awful feeling either I've done something wrong or I've missed something blatantly obvious. I've even disabled the other VB script that runs at computer startup just incase - even though it doesn't use the same variable names.

    Well it's definately running at startup. Just removed a quotation mark to check it would error - which it did. So it's running without any problems yet not managing to connect to the printers. I'm going to check permissions etc now, must be something daft.

  13. #13

    Join Date
    Mar 2007
    Location
    Central Scotland
    Posts
    829
    Thank Post
    12
    Thanked 8 Times in 8 Posts
    Rep Power
    19

    Re: Printers - adding them to machines by group policy?

    I've got something working almost the way I wanted it and posted it on the scripting section:

    http://www.edugeek.net/index.php?nam...itpost&p=97523



SHARE:
+ Post New Thread

Similar Threads

  1. Some Machines In OU Arent Picking Up Policy?
    By ben.woods.bw in forum Windows
    Replies: 1
    Last Post: 4th January 2008, 04:52 PM
  2. Deploying printers via group policy
    By Southwell in forum Windows
    Replies: 16
    Last Post: 7th December 2007, 01:28 PM
  3. Replies: 2
    Last Post: 17th May 2007, 10:54 AM
  4. Replies: 5
    Last Post: 7th February 2007, 12:28 PM
  5. Set Default Printer to Machines with Local Printers
    By Heebeejeebee in forum Windows
    Replies: 15
    Last Post: 5th February 2007, 04:00 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
  •