Jump to content

Recommended Posts

Posted

Any of you guys able to deploy Printers to Workstaions via AD.

 

I use Server 2003 R2 but so far have not got it to work.

 

How have you set up your policies etc??

Posted

Once you have 2003 R2 installed, you need to enable Printer Management (which from memory) is within Add/Remove Programs > Add/Remove Windows Components

 

You can then distribute printers per user or per computer. I generally do things per user and it works great :)

Posted
Once you have 2003 R2 installed, you need to enable Printer Management (which from memory) is within Add/Remove Programs > Add/Remove Windows Components

 

You can then distribute printers per user or per computer. I generally do things per user and it works great :)

 

 

Yeah I have that done, but im confused on how to implement this.

 

Ive created an OU with a group of machine put into it. Do I need to create a GP for that OU just for Printers to be assigned??

 

I want it on a 'Per Machine' basis.

Posted
Yes you have to create a policy if you do not have an existing unique policy for that group of computers. The deploy printers is last on the list in the machine portion of the policy.
Posted
You also need to run the application 'pushprinterconnections.exe' as a machine/user startup script in the same GPO as the deployed printer is contained in, if your clients are Windows 2000, Windows XP or Windows Server 2003.
Posted
You also need to run the application 'pushprinterconnections.exe' as a machine/user startup script in the same GPO as the deployed printer is contained in, if your clients are Windows 2000, Windows XP or Windows Server 2003.

 

Agreed! However, when I tried this with some of the more "senior" PC's, they failed. Have you tried assigning printers via a logon script?

Posted

We never managed to sucessfully get it working every time. Sometimes it works but not others. See this page for more details.

 

We reverted to a vbs script in the end which picks up the machine name (or part thereof) and assigns printers based on that. Works everytime.

 

HBJB

Posted

Don't bother with the mapping by AD it's crap... no decent way of setting a default printer which is diabolical and if you've gotta run the client anyway might as well use a logon script :rolleyes:

 

I've got a very nifty vbs file now that maps the printers by the computer's OU so the right printer "follows" the user as they login to different PCs... job done :D

Posted
Don't bother with the mapping by AD it's crap... no decent way of setting a default printer which is diabolical and if you've gotta run the client anyway might as well use a logon script :rolleyes:

 

I've got a very nifty vbs file now that maps the printers by the computer's OU so the right printer "follows" the user as they login to different PCs... job done :D

 

 

:eek::eek::eek::eek::eek:!!!!!!!1111111oneoneone May I please have a copy of that vbs script? That would save me a LOT of time. I've been looking for a way to do this for ages. Map printers based on location. Much appreciated! Thanks!

Posted (edited)

PM'd this to someone else before so prob easier just to whack it on this thread :)

 

Here's the script, built it from 2-3 different ones I found over time...

 

Should be obvious from the script anyway but just to mention that it follows the Computer's OU so if all your machines are just plonked in one place it won't make much difference... but then who doesn't sort them by room :p

 

'*************************************

'Maps new printers based on current OU

'*************************************

 

dim printmsg

 

dim strUserName ' Current user

 

Set objNetwork = CreateObject("WScript.Network")

strUserName = objNetwork.UserName

 

Set objSysInfo = CreateObject("ADSystemInfo")

strName = objSysInfo.ComputerName

 

arrComputerName = Split(strName, ",")

arrOU = Split(arrComputerName(1), "=")

strComputerOU = arrOU(1)

 

'****************************************

'Map Department Printers from Computer OU

'****************************************

 

objNetwork.AddWindowsPrinterConnection "\\server\printer1"

 

Select Case strComputerOU

 

Case "001"

objNetwork.AddWindowsPrinterConnection "\\server\printer2"

objNetwork.AddWindowsPrinterConnection "\\server\printer3"

objNetwork.SetDefaultPrinter "\\server\printer2"

Case "003"

objNetwork.AddWindowsPrinterConnection "\\server\printer4"

objNetwork.SetDefaultPrinter "\\server\printer4"

Case Else

objNetwork.SetDefaultPrinter "\\server\printer5"

 

End Select

 

'************************************

'Map Colour Printer by Security Group

'************************************

 

strUserPath = "LDAP://" & objSysInfo.UserName

Set objUser = GetObject(strUserPath)

 

For Each strGroup in objUser.MemberOf

strGroupPath = "LDAP://" & strGroup

Set objGroup = GetObject(strGroupPath)

strGroupName = objGroup.CN

 

Select Case strGroupName

 

Case "ColourPrinter"

printmsg = MsgBox("You now have access to the colour printer ",64,"Printers")

objNetwork.AddWindowsPrinterConnection "\\server\colourprinter"

 

End Select

Next

 

Note the first printer mapping with the line

 

objNetwork.AddWindowsPrinterConnection "\\server\printer1"

 

That's there in case you have a global printer you always use, saves writing it on each line!

 

You can also lose the printmsg line at the end if you don't want the dialog box to pop up, only did that so I could see if the colour printer part was running.

 

The end bit also maps a printer by security group, in my case it's a way to restrict colour print access, if not required just remove the last section and also the dim printmsg line at the beginning.

 

The script works by the OU the computer is in, so you just need the OU name, no need to give nested group names, full DN etc.

 

Another script I use with this as well is one to delete all network printers before mapping any new ones...

 

'****************************

'Deletes old network printers

'****************************

 

On error Resume Next

Dim cNetCommands, vPrinterName, vPrinterPath

Set cNetCommands = WScript.CreateObject("WScript.Network")

Set vPrinterPath = cNetCommands.EnumPrinterConnections

For Each vPrinterName in vPrinterPath

cNetCommands.RemovePrinterConnection(vPrinterName)

Next

Wscript.Quit

 

Hope this helps, let me know how you get on...

Edited by gshaw
  • Thanks 1
Posted

Get con2prt.exe and put in your logon folder. (http://www.gruppenrichtlinien.de/tools/con2prt.exe)

 

con2prt does not need any special rights on the user to connect printers.

Create a new logon script that you use on a gpo with your users in in this way:

 

@echo off
%logonserver%\netlogon\con2prt /f    <<-- this deletes all connected printers (only network printers, no local printers!)

if /i %computername:~0,3%==114 goto h114  <<-- this reads the first 3 letters of the computername and then jumps to the connect line for the room that follows:

goto end

:h114
%logonserver%\netlogon\con2prt /cd "\\s1\h114" <<-- this connects the printer h114 that is created on a server [called s1 in this example] and sets it to the default printer
%logonserver%\netlogon\con2prt /c "\\s1\h114c"
goto end

:end

 

You have to simply create a if-case for every room and a :room definition and it will work. Simply and fast.

 

Bye,

bjoern

  • Thanks 1
Posted (edited)

Thanks to both of you deepsky and gshaw for your help! Question for deepsky, in your code you have

 

:h114

%logonserver%\netlogon\con2prt /cd "\\s1\h114" <<-- this connects the printer h114 that is created on a server [called s1 in this example] and sets it to the default printer

%logonserver%\netlogon\con2prt /c "\\s1\h114c"

goto end

 

was there a difference between /cd as you put in the first line and /c as you put in the second line?

 

-----------------------------------

 

Another question, if I'm doing this by OU like in gshaw's suggestion, how do I write an OU that's within another OU? Normally I guess I'd just say "Staff" for example? But what if I have an OU called Library for library computers, and theres 5 staff machines in there, and 30 student machines. How would it work? If the OU Domain Root>Staff Computers>Library, and Domain Root>Student Computers>Library, both contain computers in an OU called Library, within seperate other OU's, how would it know the difference if I just entered "Library" between the two different OU's named identically? Or do I show the path of the OU somehow? Thanks!

Edited by link470
Posted

I use a very similar vbs script and it works very well. I use it based on a machine name, and what I do is create what I call "zones". Each zone prints to a unique printer. So what I do is use the 5th letter of the name to put in a letter like A or B or C. So I do it like this |School Name| Zone Letter| Room| Computer Number|. An example of this in use at a school named unionpoint, and in zone b would be: unioB252-3.

 

The script I uses reads the 5th letter and attaches the printer based off of that.

Posted
Thanks to both of you deepsky and gshaw for your help! Question for deepsky, in your code you have

 

:h114

%logonserver%\netlogon\con2prt /cd "\\s1\h114" <<-- this connects the printer h114 that is created on a server [called s1 in this example] and sets it to the default printer

%logonserver%\netlogon\con2prt /c "\\s1\h114c"

goto end

 

was there a difference between /cd as you put in the first line and /c as you put in the second line?

 

-----------------------------------

 

At a wild guess I'd say the /cd means - 'connect' + 'set default', so it sets \\s1\h114 as the default printer, whereas the /c is simply 'connect'.

 

Az

Posted
At a wild guess I'd say the /cd means - 'connect' + 'set default', so it sets \\s1\h114 as the default printer, whereas the /c is simply 'connect'.

 

Az

 

Aye, /c = connect ; /cd connect + default printer :)

Posted

ok, ive managed to add printers to machines via GPO....BUT the default printer is set to Microsoft Document Image Writer.

 

How do I change the default???

Posted
ok, ive managed to add printers to machines via GPO....BUT the default printer is set to Microsoft Document Image Writer.

 

How do I change the default???

 

Quite simply... you can't hence why it's crap :p

 

Think I remember someone saying it works on the name of the first printer mapped, or order of how they get installed or something stupid like that :rolleyes:

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