?
Solved

Printer install trough batch script Windows 7

Posted on 2011-02-11
6
Medium Priority
?
1,577 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
  • 2
  • 2
5 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

839 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