Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Automatically add printers to computers when they join domain.

Posted on 2008-06-17
20
Medium Priority
?
428 Views
Last Modified: 2010-04-18
I am the network administrator for a client running Server 2003. We have about 10 client machines running xp. Is there a way that i can force the client machines to automatically connect to all available domain printers when they join the domain? Or have the server detect a new client and push out all the printers to that client?
0
Comment
Question by:MCSComputersServices
  • 10
  • 9
20 Comments
 
LVL 7

Accepted Solution

by:
txhockey26 earned 2000 total points
ID: 21803600
Several ways to accomplish this.   If you would like to use GP and you the server is 2003 R2:
http://www.windowsnetworking.com/articles_tutorials/Deploying-Printers-Group-Policy-Windows-R2.html

For VBScript....Chris-Dent has a quick walk through on here:
http://www.experts-exchange.com/Programming/Languages/Scripting/Q_22390164.html
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21803620
The only method I know of is using scripts to add printer connections. The script can be either a account based profile script or a Group Policy user logon script.

Below is a sample of a VB script used to add a printer. You can simple modify it to include any printers you want.

Create the script name it was a .vbs file, either place it in the scripts folder or add it in a group policy at"user->Windows-> Scripts->Logon".
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21803633
Opps forgot the code.
Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"
WshNetwork.SetDefaultPrinter "\\PrintServer1\Xerox300"

Open in new window

0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:MCSComputersServices
ID: 21805468
So if i copy the script you wrote and just replace your xerox  printer with the one i use, it should work?  Also wondering why you skipped a line?
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21805618
If you copy that script into a file with the .vbs extension and modify it as you states, yes it should work.

The blank line doesn't affect the script, other than to make it easier to read.
0
 

Author Comment

by:MCSComputersServices
ID: 21807148
How do i do it if i have multiple printers?  Seperate scripts or all in one?  Im not very knowledgable on scripts.
0
 

Author Comment

by:MCSComputersServices
ID: 21807203
Also, i assume they have to be logging into their domain accounts and not to the local computer that is a member of the domain?
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21807356
That is correct as it would be a user policy.

You can add as many printers as you want simply by adding more of the add printer lines with the different UNC names. Put each one on its own line.
0
 

Author Comment

by:MCSComputersServices
ID: 21807406
I made a script and added it to the logon session of a user. When i logon as that user the printer is still not added? Do i need to publish the printer in group policy?
0
 

Author Comment

by:MCSComputersServices
ID: 21807457
My network is named "AlpineOrthopedic"  I changed the script where is said WSHnetwork to alpineorthopedicnetwork.  Is that right?
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21807563
You should only be changing the sharename and patch of the printer.

Ie in:
WshNetwork.AddWindowsPrinterConnection "\\PrintServer1\Xerox300"

Only change the path to the printer share. See the code section for a script example that adds three printers and sets the default printer to a printer shared as "HPLJ4250" on a server named "ServerDC1"

The Set WshNetwork = CreateObject("WScript.Network") line is a necessary line for the script to operate, do not change this line.

The "WshNetwork.AddWindowsPrinterConnection "\\ServerDC1\HPLJ4250"" line adds a printer connection.

The WshNetwork.SetDefaultPrinter "\\ServerDC1\HPLJ4250" sets the default printer
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21807572
Forgot to add the code section again.
Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\ServerDC1\HPLJ4250"
WshNetwork.AddWindowsPrinterConnection "\\ServerDC1\HPLJ4050"
WshNetwork.AddWindowsPrinterConnection "\\ServerDC1\ColorLJ3600"
WshNetwork.SetDefaultPrinter "\\ServerDC1\HPLJ4250"

Open in new window

0
 

Author Comment

by:MCSComputersServices
ID: 21807708
ok, here is my script. For some reason it still doesnt add the printer when the user logs on.
Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\alps\HP Laserjet 1320 PCL 6"
WshNetwork.SetDefaultPrinter "\\alps\HP Laserjet 1320 PCL"

Alps is the name of the DC and HP Laserjet 1320 pcl 6 is the printer
0
 

Author Comment

by:MCSComputersServices
ID: 21807734
I changed the name of the printer to "Nurse Printer"
Here is my new script.

Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\serveralps\NursePrinter"
WshNetwork.SetDefaultPrinter "\\serveralps\NursePrinter"

When i try to run the script, it says printer name invalid
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21807777
Are you using the name of the printer as it appears in "printers and faxes" or its share name? This script references the share location, so you would need ot utilize the share name(located in the sharing tab of the printer's properties".

Also you don't need to put the word "server" in front of the servername unless that is its actual name.

So if the server is called "ALPS" and the printer's share name is "NursePrinter", use:
WshNetwork.AddWindowsPrinterConnection "\\alps\NursePrinter"

If the server is called "ServerAlps" and the printer share name is "Jumbalya" use:
WshNetwork.AddWindowsPrinterConnection "\\serveralps\jumbalya"

So in your case, I will assume that the server is named "Alps" and the printer share name is "NursePrinter", the script you need would be as follows.


Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\Alps\NursePrinter"
WshNetwork.SetDefaultPrinter "\\Alps\NursePrinter"

Open in new window

0
 

Author Comment

by:MCSComputersServices
ID: 21807864
When you say server, do you mean my DC or the computer that the printer is physically connected too?
I apologize if i am asking stupid questions, i am learning as i go.
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21808093
By server, I mean the computer which is sharing the printer. The format of a UNC share name is

\\computername\sharename

In this instance, for "computername" use the name of the device that is sharing the printer, and for "sharename" use the share name of the printer as listed in the "sharing" tab of the printer's properties.

I step you through locating this information if needed. Let me know.
0
 

Author Comment

by:MCSComputersServices
ID: 21814905
I am trying to use a different printer this time. The share name of the printer is "recoveryprinter"
It was installed from a computer named gloria even though its installed on a tcp/ip port.
Here is the script.
Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\Alps\recoveryprinter"
WshNetwork.SetDefaultPrinter "\\Alps\recoveryprinter"

I used alps as the server because its on a tcp/ip port. When i try to change the name of the share using the computer named gloria, it says i cant so i assume i need to use the server to do it.
When i try to run the script it says printer name invalid. I know this shouldnt be this hard to make a simple script run.
0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21815043
Since the printer is shared from the computer named Gloria, you need to change the script to connect to gloria not alps..

Now, being a printer connected from a TCP/IP port, you can install he printer directly on Alps using the tcp/ip port and share it as "recoveryprinter" and your script would work. Otherwise you need to change to script to connect to the computer sharing the printer, in this case it seems to be "Gloria"(see below).

Remember, your connecting to a share on a server or pc, the script is simply trying to connect to a share at the location you specify. Your script is trying to connect to alps but recoveryprinter is shared on gloria, as such the printer name is invalid because there is no printer currently shared as "recoveryprinter" on alps.

I hope this helps.


=====Script to connect to printer shared on gloria=======

Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\gloria\recoveryprinter"
WshNetwork.SetDefaultPrinter "\\gloria\recoveryprinter"

=====end=====


=====Script to connect to printer shared on alps=====

Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\Alps\recoveryprinter"
WshNetwork.SetDefaultPrinter "\\Alps\recoveryprinter"

=====End=====


 
Set WshNetwork = CreateObject("WScript.Network")
 
WshNetwork.AddWindowsPrinterConnection "\\gloria\recoveryprinter"
WshNetwork.SetDefaultPrinter "\\gloria\recoveryprinter"

Open in new window

0
 
LVL 6

Expert Comment

by:raptorjb007
ID: 21884379
Any luck?
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question