Solved

Printer install trough batch script Windows 7

Posted on 2011-02-11
6
1,516 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
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now