Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 3098

Installing IP printer via batch script

$
0
0

I have been trying to get a quick batch file together to install IP printer's to users machines I was basing it off this post http://community.spiceworks.com/scripts/show/1056-install-network-printer but it continually does not work.  I have it working perfectly on my laptop it adds the printers but then when i try it on another computer it does not add the printer.  It does however add the ip under the ports so it seems like some of the script is working and i have checked and made sure all of the .vbs files it calls are in the correct spot.  Any ideas on what might be wrong or a better way of doing this via a script would be helpful.


BASH
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
CLS
@ECHO off

SET varIP=192.168.0.200
SET varDriver=HP Color LaserJet CP2020 Series PCL 6
SET varDriverFolder=\\Server\\Software\\Hardware\\Drivers\\Printers\\HP CP2025DN\\
SET varDriverFile=\\Server\\Software\\Hardware\\Drivers\\Printers\\HP CP2025DN\\hppcp610.inf
SET varName=Reception
SET varLocation=Reception

REM "Deleting TCP/IP port"
REM CSCRIPT /nologo %windir%\system32\prnport.vbs -d -r IP_%varIP%

REM "Creating TCP/IP port"
CSCRIPT /nologo %windir%\system32\prnport.vbs -a -r IP_%varIP% -o raw -n 9100 -h %varIP%

CLS
REM "Installation message"
@ECHO.
@ECHO The %varLocation% printer is currently being installed.
@ECHO.
@ECHO Please do not close this window.
@ECHO.
@ECHO Once the installation is complete this Setup window will exit.
@ECHO.

REM "Driver installation"
CSCRIPT /nologo %windir%\system32\prndrvr.vbs -a -m "%varDriver%" -h "%varDriverFolder%" -i "%varDriverFile%"  
CLS

REM "Printer deletion"
@ECHO.
@ECHO Completing installation.
CSCRIPT /nologo %windir%\system32\prnmngr.vbs -d -p "%varName%" 
CLS

REM "Printer installation"
@ECHO.
@ECHO Completing installation.
CSCRIPT /nologo %windir%\system32\prnmngr.vbs -a -p "%varName%" -m "%varDriver%" -r "IP_%varIP%"
CLS

REM "Location configuration"
@ECHO.
@ECHO Completing installation.
CSCRIPT /nologo %windir%\system32\prncnfg.vbs -t -p "%varName%" -l "%varLocation%"
CLS

REM "Making it Default printer"
REM CSCRIPT %windir%\system32\prnmngr.vbs -p "%varName%" -t

 


Viewing all articles
Browse latest Browse all 3098

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>