Solved

Printer install trough batch script Windows 7

Posted on 2011-02-11
6
1,547 Views
Last Modified: 2012-05-11
I need a way to install a printer through a batch script or maybe a .vb script. In Windows XP i used the build in .vb scripts.

CScript prnmngr.vbs -a -p "Printer" -m "Samsung ML-2850 Series" -r "IP_172.16.0.201"
CScript prnmngr.vbs -p "Printer" -t
CScript prnqctl.vbs -e -p Printer

But in Winodws 7 i can't find an option like this. The Driver and the Port are installed, so i just need to install the Printer.

Thanks  
0
Comment
Question by:SH1986
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 

Expert Comment

by:helldesk_pit
ID: 34869776
net use \\server\printer or
net use \\printer

this will install the drivers for all users.
0
 

Author Comment

by:SH1986
ID: 34869838
The problem is that this is not a shared printer on the network, so that would not be possibility. All the printers are local network printers.
0
 

Expert Comment

by:helldesk_pit
ID: 34869971
net use \\172.16.0.201 /persistent:yes

run it as a part of your logon script.
it doesn't have to be on the server to use net use.

0
 

Author Comment

by:SH1986
ID: 34870102
Nope, does not work:

C:\Users\hor.thefirm>net use \\10.0.0.205 /persistent:yes
System error 53 has occurred.

The network path was not found.

Maybe i should tell how this is meant to be used. We are not using as a part of a logonscript, it's just a batch script we execute:

@ECHO OFF
cd %SystemRoot%\System32\
:chgerror
ECHO ......................................
ECHO          Printer Changing Menu
ECHO ......................................
ECHO.
ECHO What printer do you have?
ECHO.
ECHO 1 - HP LaserJet 1320n
ECHO 2 - HP LaserJet 2015n
ECHO 3 - HP LaserJet P2055
ECHO 4 - Samsung ML-2850 Series
ECHO 5 - Samsung CLP-310 Series
ECHO 6 - Samsung CLP-320 Series
ECHO.
SET /P P=Make your choice..:
IF %P%==1 GOTO chg1
IF %P%==2 GOTO chg2
IF %P%==3 GOTO chg3
IF %P%==4 GOTO chg4
IF %P%==5 GOTO chg5
IF %P%==6 GOTO chg6
cls
ECHO ***********ERROR IN SELECTION***********
goto chgerror
:chg1
SET prtmodel=hp LaserJet 1320 PCL 5e
GOTO chgport
:chg2
SET prtmodel=HP LaserJet P2015 Series PCL 5e
GOTO chgport
:chg3
SET prtmodel=HP LaserJet P2050 Series PCL6
GOTO chgport
:chg4
SET prtmodel=Samsung ML-2850 Series
GOTO chgport
:chg5
SET prtmodel=Samsung CLP-310 Series
GOTO chgport
:chg6
SET prtmodel=Samsung CLP-320 Series
GOTO chgport
:chgport
CLS
:conferror
ECHO ......................................
ECHO          Printer Changing Menu
ECHO ......................................
ECHO.
ECHO 1  - Will set printer to: 192.168.1.201
ECHO 2  - Will set printer to: 192.168.1.202
ECHO 3  - Will set printer to: 192.168.1.203
ECHO 4  - Will set printer to: 192.168.1.204
ECHO 5  - Will set printer to: 192.168.1.205
ECHO 6  - Will set printer to: 192.168.1.206
ECHO 7  - Will set printer to: 192.168.1.207
ECHO 8  - Will set printer to: 192.168.1.208
ECHO 9  - Will set printer to: 192.168.1.209
ECHO 10 - Will set printer to: 192.168.1.210
ECHO 11 - Will set printer to: 172.16.0.201 (Telenor)
ECHO.
SET /P M=Make your choice..:
IF %M%==1 GOTO 01
IF %M%==2 GOTO 02
IF %M%==3 GOTO 03
IF %M%==4 GOTO 04
IF %M%==5 GOTO 05
IF %M%==6 GOTO 06
IF %M%==7 GOTO 07
IF %M%==8 GOTO 08
IF %M%==9 GOTO 09
IF %M%==10 GOTO 10
IF %M%==11 GOTO 11
IF %M%==Exit GOTO Exit
cls
ECHO ***********ERROR IN SELECTION***********
goto conferror
:01
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.201"
GOTO Exit
:02
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.202"
GOTO Exit
:03
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.203"
GOTO Exit
:04
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.204"
GOTO Exit
:05
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.205"
GOTO Exit
:06
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.206"
GOTO Exit
:07
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.207"
GOTO Exit
:08
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.208"
GOTO Exit
:09
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.209"
GOTO Exit
:10
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_192.168.1.210"
GOTO Exit
:11
CScript prnmngr.vbs -a -p "Printer" -m "%prtmodel%" -r "IP_172.16.0.201"
:EXIT
CScript prnmngr.vbs -p "Printer" -t
cscript prnqctl.vbs -e -p Printer
cls

0
 
LVL 6

Accepted Solution

by:
RootsMan earned 250 total points
ID: 34880837
Do you get an error when you run the command at the Command Prompt?

CScript prnmngr.vbs -a -p "Printer" -m "Samsung ML-2850 Series" -r "IP_172.16.0.201"

Open in new window


Under Windows 7, the Printing Admin .vbs Scripts are in:
C:\Windows\System32\Printing_Admin_Scripts\en-US\

Try:
cd %SystemRoot%\System32\Printing_Admin_Scripts\en-US\

Open in new window

0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

One of the features I've come to appreciate about Windows 7 and Windows Server 2008 R2 is the ability to pin applications to the task bar. As useful a feature as I've found this, it does have some quirks.  For example, have you ever tried pinning an…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

688 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