Link to home
Create AccountLog in
Avatar of SH1986
SH1986

asked on

Printer install trough batch script Windows 7

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  
Avatar of helldesk_pit
helldesk_pit

net use \\server\printer or
net use \\printer

this will install the drivers for all users.
Avatar of SH1986

ASKER

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.
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.

Avatar of SH1986

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of RootsMan
RootsMan
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account