Avatar of cgooden01
cgooden01Flag for United States of America

asked on 

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

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
VB ScriptPrinters and ScannersMicrosoft DOS

Avatar of undefined
Last Comment
hdhondt
Avatar of ShrCol
ShrCol
Flag of United Kingdom of Great Britain and Northern Ireland image

This resource helped me recently in a similar situation: http://www.robvanderwoude.com/2kprintcontrol.php - also works with Windows 7.
Avatar of hdhondt
hdhondt
Flag of Australia image

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
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

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
Avatar of hdhondt
hdhondt
Flag of Australia image

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.
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

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.  
Avatar of hdhondt
hdhondt
Flag of Australia image

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.
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

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
Avatar of jrtec
jrtec
Flag of Portugal image

Can you tell us the brand and model of the printers. Some manufacturers have their own tools for creating that.
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

Thanks but i have already accomplished this with some fine tweaking of DOS commands lines. But appreciate the assistance.  
Avatar of hdhondt
hdhondt
Flag of Australia image

Can you please tell us what you did?
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

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.  
ASKER CERTIFIED SOLUTION
Avatar of hdhondt
hdhondt
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of cgooden01
cgooden01
Flag of United States of America image

ASKER

Thank you..
Avatar of hdhondt
hdhondt
Flag of Australia image

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

VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

39K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo