batch file to install printer

S

Steve Cummings

Hi -
I work for a non profit organization and we are trying to find a way to run
a Batch File that Installs a Local TCP/IP Printer with a specific IP address
with NO user interaction.
I have code that works for a BATCH file but it has to be run as a local
administrator. I am trying to have this batch file run as a login script on
our network to a bunch of laptop users on our domain.

Here is what I have -

-----------
cd c:\windows\system32
cscript prnport.vbs -a -r IP_192.168.1.115 -h 192.168.1.115 -o raw -n 9100
cscript prnmngr.vbs -a -p "Xerox Printer" -m "Xerox 4510" -r
"IP_192.168.1.115"
pause

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

Ive tried this using a Run-As with the same code from above - but that
requires entering in a Password and we need this done automattically.
Also - the 2nd command does not work using Run as but the First command
does - i find that strange as well.

------------
cd c:\windows\system32
runas /profile /user:Domain\Account "cscript prnport.vbs -a -r
IP_192.168.1.115 -h 192.168.1.115 -o raw -n 9100"
runas /profile /user:Domain\Account "cscript prnmngr.vbs -a -p "Xerox
Printer" -m "Xerox 4510" -r "IP_192.168.1.115""
pause
-------------


If you can assist with another way of doing this or a way of doing this
using the same code would be really helpful.
I've done alot of research online and there seems to be no real way of doing
this.
I have tried many 3rd party applications that is suppposed to make this work
easily but I have not had any luck with getting it to work.

Let me know.

Thanks,
Steve
 
L

Linn Kubler

Hi Steve,

Finally, a question I can offer some help on. I'm curious though, why you
want to add a printer in a logon script, wouldn't that re-add the printer
each time the user logs on to the computer?

What I do is add the network printer globally to the workstation. Then it
is available for all users. Here is a helpful site that discusses this
option:

http://members.shaw.ca/bsanders/NetPrinterAllUsers.htm

Here is a sample script I use for remotely installing a printer on a
computer. The computer must be running but does not need to have the local
administrator logged in. However, you do need to run the script as a user
who has administrative rights on the remote computer. In my case I run this
script logged in as the domain administrator and pass the name of the remote
computer as a parameter.

My script has two lines:
rundll32 printui.dll, PrintUIEntry /ga /n\\cmw-exch\CLAIMS /c\\%1
pause

If I call this script, remote_claims_printer_install.cmd, I would run it
like this, from the command prompt:

c:\>remote_claims_pritner_install.cmd comp1

To make the printer available to the end user you have to restart the print
spooler, but a reboot will handle that if you can wait. Otherwise there's a
couple of ways to remotely restart a service.

Hope that all helps,
Linn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top