Jump to content

Printers - adding them to machines by group policy?


Recommended Posts

Posted

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?

Posted

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.

Posted

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.

 

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.

Posted
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!
Posted

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.

Posted
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 :?

Posted

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

Posted
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.

Posted

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* :p

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...