Schlagwort-Archive: prnport

Einen Drucker automatisiert installieren mit einem Batch Skript

Ich wusste lange nicht, wie ich einen Drucker TCP/IP Port automatisiert erstellen konnte aber bei einem nochmaligen googeln viel mir die Lösung mit den „printing admin scripts“ auf. Nach kurzem rumprobieren kam folgendes Skript dabei raus, dass 2 gleichartige Drucker die auf verschiedenen Etagen stehen einmal mit dem Postscript und das anderemal mit einem Generic PCL Treiber installiert. Damit wollen wir es den Usern einfacher machen S/W zu drucken, ohne beim Drucker was umstellen zu müssen.

<pre>@echo off

rem pcl
SET InfPath32="\\hostname\Canon iR Adv C5030i\iR5030Win7  PCL6\32BIT\Driver\pcl6\cnp60G.inf"
SET InfPath64="\\hostname\Canon iR Adv C5030i\iR5030Win7  PCL6\x64\Driver\pcl6\cnp60Ga64.inf"
rem postscript
SET InfPath32ps="\\hostname\Canon iR Adv C5030i\iR5030 Win7 PS\32BIT\Driver\CNS30G.INF"
SET InfPath64ps="\\hostname\Canon iR Adv C5030i\iR5030 Win7 PS\x64\Driver\CNS30GA64.INF"
SET PrnName3SW="Canon S/W 3. Stock"
SET PrnName6SW="Canon S/W 6. Stock"
SET PrnName3Farbe="Canon Farbe 3. Stock"
SET PrnName6Farbe="Canon Farbe 6. Stock"
SET PrnType="Canon iR-ADV C5030/5035 PS3"
SET PrnTypePCL="Canon Generic PCL6 Driver"
SET PortIP_3_Stock=192.168.xxx.xxx
SET PortIP_6_Stock=192.168.xxx.xxx

systeminfo | find "Windows 7"
if %ERRORLEVEL% == 0 goto Win7

systeminfo | find "Windows XP"
if %ERRORLEVEL% == 0 goto WinXP

:Win7
echo Running Windows 7 Script

rem check if 32 or 64 bit
Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry% > C:\Windows\Temp\checkOS.txt
Find /i "x86" < C:\Windows\Temp\CheckOS.txt > C:\Windows\Temp\StringCheck.txt

If %ERRORLEVEL% == 0 (
    Echo "This is 32 Bit Win7"
  rem pcl 3 stock s/w
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows NT x86" -i %InfPath32%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_"%PortIP_3_Stock%"

  rem pcl 6 stock s/w
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows NT x86" -i %InfPath32%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_"%PortIP_6_Stock%"

  rem postscript 3 farbe
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows NT x86" -i %InfPath32ps%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_"%PortIP_3_Stock%"

  rem postscript 6 farbe
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows NT x86" -i %InfPath32ps%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_"%PortIP_6_Stock%"
  ) ELSE (
    Echo "This is 64 Bit Win7"
  rem pcl 3 stock s/w
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows x64" -i %InfPath64%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_"%PortIP_3_Stock%"

  rem pcl 6 stock s/w
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows x64" -i %InfPath64%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_"%PortIP_6_Stock%"

  rem postscript 3 farbe
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows x64" -i %InfPath64ps%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_"%PortIP_3_Stock%"

  rem postscript 6 farbe
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows x64" -i %InfPath64ps%
  cscript C:\Windows\System32\Printing_Admin_Scripts\de-DE\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_"%PortIP_6_Stock%")
goto exit

 

:WinXP
echo Running Windows XP Script

rem check if 32 or 64 bit
Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0
REG.exe Query %RegQry% > C:\Windows\Temp\checkOS.txt
Find /i "x86" < C:\Windows\Temp\CheckOS.txt > C:\Windows\Temp\StringCheck.txt

If %ERRORLEVEL% == 0 (
  Echo "This is 32 Bit WinXP"
  rem pcl 3 stock s/w
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows NT x86" -i %InfPath32%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_"%PortIP_3_Stock%"

  rem pcl 6 stock s/w
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows NT x86" -i %InfPath32%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_"%PortIP_6_Stock%"

  rem postscript 3 farbe
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows NT x86" -i %InfPath32ps%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_"%PortIP_3_Stock%"

  rem postscript 6 farbe
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows NT x86" -i %InfPath32ps%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_"%PortIP_6_Stock%"
  ) ELSE (
    Echo "This is 64 Bit WinXP"
  rem pcl 3 stock s/w
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows x64" -i %InfPath64%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_"%PortIP_3_Stock%"

  rem pcl 6 stock s/w
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e "Windows x64" -i %InfPath64%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_"%PortIP_6_Stock%"

  rem postscript 3 farbe
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows x64" -i %InfPath64ps%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_"%PortIP_3_Stock%"

  rem postscript 6 farbe
  cscript c:\windows\system32\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100
  cscript c:\windows\system32\prndrvr.vbs -a -m %PrnType% -v 3 -e "Windows x64" -i %InfPath64ps%
  cscript c:\windows\system32\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_"%PortIP_6_Stock%"
  )
goto exit

:exit
pause</pre>