Adding a printer via a batch file to a network printer but not on a print Server

cgooden01
cgooden01 used Ask the Experts™
on
Architecture does not currently support a Print Server at this time, so what im looking for is a simply desktop batch file that will add a printer using the rundll32 printui.dll......etc command line.  this commands opens up the wizard, but im trying to find a way that it will include creating a Standard TCP/IP port and adding the hostname or IP address and printer type.  is this possible. Would help me tremendously.  Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
This resource helped me recently in a similar situation: http://www.robvanderwoude.com/2kprintcontrol.php - also works with Windows 7.
You can create the TCP/IP port with PRNPORT.VBS.

To add a standard TCP/IP printing port on the server \\Server1 that connects to a network printer at 10.2.3.4 and uses the TCP raw protocol on port 9100, type:

Cscript Prnport.vbs -a -s Server1 -r IP_10.2.3.4 -h 10.2.3.4 -o raw -n 9100

For more info see:

http://technet.microsoft.com/en-us/library/cc754352(WS.10).aspx

Author

Commented:
THanks but i alreayd have this information. Still looking at a way to batch script this and not based upon IP address, because our printers are issued out ip address via DHCP.  Just want to script this out using hostname
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Printers are always addressed by their IP address (or by the port name - IP_10.2.3.4 in the example). The IP address and the port name are the 2 data items you need to supply to create a Standard TCP/IP port.

Your requirement for a hostname seems to imply that your printers can get varying addresses with DHCP. That is a recipe for trouble: printers *must* have a fixed IP address. You can reserve addresses for them on the DHCP server to prevent this.

Author

Commented:
Yes i know, very well aware of that and still trying to get our enterprise administrators to implement a print server but to no avail at this current time, so everything unfortunately is based upon hostname and not IP addresses like they should be.  Definitely a disaster waiting to happen, but simply having a printer server would resolve these issues, but until then, i can only work with what i have now.  
Do you mean you address the printers as \\printername? That will only work with printers that support SMB, and there are not many of them. Or are you trying to somehow tie the printer's hostname to the IP address? I don't know of any way to do that, except by DHCP.

Your question stated "creating a Standard TCP/IP port and adding the hostname or IP address and printer type". For a TCP/IP port you do not need the hostname.

Author

Commented:
Yes via DHCP the printers are attached, but users are creating printers via the hostname instead the of the tried and true way of IP addressing, but since these addresses change every 10-14 days, no use in setting it up using IP schema.   Maybe im not making myself clear.  If you run the setup wizard for adding a printer.  you will get  the option to add a local printer then you proceed to create a new port and you select Standard TCP/IP port in which you can specified the hostname instead of IP address

Commented:
Can you tell us the brand and model of the printers. Some manufacturers have their own tools for creating that.

Author

Commented:
Thanks but i have already accomplished this with some fine tweaking of DOS commands lines. But appreciate the assistance.  
Can you please tell us what you did?

Author

Commented:
What i did to our baseline images that were to be deployed. I created the printers on the image to be cloned and then deployed them that way.  
Thanks, cgooden01

Make sure you close the question and accept your own answer, so your points will be refunded.

Author

Commented:
Thank you..
Thanks again, but I'm afraid I don't understand: you came up with the answer yourself, and gave me the points???

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial