{"id":157,"date":"2011-12-15T18:00:46","date_gmt":"2011-12-15T17:00:46","guid":{"rendered":"http:\/\/hamsterhirn.de\/?p=157"},"modified":"2012-12-12T15:37:46","modified_gmt":"2012-12-12T14:37:46","slug":"einen-drucker-automatisiert-installieren-mit-einem-batch-skript","status":"publish","type":"post","link":"https:\/\/hamsterhirn.de\/index.php\/2011\/12\/einen-drucker-automatisiert-installieren-mit-einem-batch-skript\/","title":{"rendered":"Einen Drucker automatisiert installieren mit einem Batch Skript"},"content":{"rendered":"<p>Ich wusste lange nicht, wie ich einen Drucker TCP\/IP Port automatisiert erstellen konnte aber bei einem nochmaligen googeln viel mir die L\u00f6sung mit den &#8222;printing admin scripts&#8220; 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\u00fcssen.<\/p>\n<p><code><\/p>\n<pre>@echo off\r\n\r\nrem pcl\r\nSET InfPath32=\"\\\\hostname\\Canon iR Adv C5030i\\iR5030Win7  PCL6\\32BIT\\Driver\\pcl6\\cnp60G.inf\"\r\nSET InfPath64=\"\\\\hostname\\Canon iR Adv C5030i\\iR5030Win7  PCL6\\x64\\Driver\\pcl6\\cnp60Ga64.inf\"\r\nrem postscript\r\nSET InfPath32ps=\"\\\\hostname\\Canon iR Adv C5030i\\iR5030 Win7 PS\\32BIT\\Driver\\CNS30G.INF\"\r\nSET InfPath64ps=\"\\\\hostname\\Canon iR Adv C5030i\\iR5030 Win7 PS\\x64\\Driver\\CNS30GA64.INF\"\r\nSET PrnName3SW=\"Canon S\/W 3. Stock\"\r\nSET PrnName6SW=\"Canon S\/W 6. Stock\"\r\nSET PrnName3Farbe=\"Canon Farbe 3. Stock\"\r\nSET PrnName6Farbe=\"Canon Farbe 6. Stock\"\r\nSET PrnType=\"Canon iR-ADV C5030\/5035 PS3\"\r\nSET PrnTypePCL=\"Canon Generic PCL6 Driver\"\r\nSET PortIP_3_Stock=192.168.xxx.xxx\r\nSET PortIP_6_Stock=192.168.xxx.xxx\r\n\r\nsysteminfo | find \"Windows 7\"\r\nif %ERRORLEVEL% == 0 goto Win7\r\n\r\nsysteminfo | find \"Windows XP\"\r\nif %ERRORLEVEL% == 0 goto WinXP\r\n\r\n:Win7\r\necho Running Windows 7 Script\r\n\r\nrem check if 32 or 64 bit\r\nSet RegQry=HKLM\\Hardware\\Description\\System\\CentralProcessor\\0\r\nREG.exe Query %RegQry% > C:\\Windows\\Temp\\checkOS.txt\r\nFind \/i \"x86\" < C:\\Windows\\Temp\\CheckOS.txt > C:\\Windows\\Temp\\StringCheck.txt\r\n\r\nIf %ERRORLEVEL% == 0 (\r\n    Echo \"This is 32 Bit Win7\"\r\n\trem pcl 3 stock s\/w\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows NT x86\" -i %InfPath32%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem pcl 6 stock s\/w\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows NT x86\" -i %InfPath32%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_\"%PortIP_6_Stock%\"\r\n\r\n\trem postscript 3 farbe\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows NT x86\" -i %InfPath32ps%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem postscript 6 farbe\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows NT x86\" -i %InfPath32ps%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_\"%PortIP_6_Stock%\"\r\n\t) ELSE (\r\n    Echo \"This is 64 Bit Win7\"\r\n\trem pcl 3 stock s\/w\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows x64\" -i %InfPath64%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem pcl 6 stock s\/w\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows x64\" -i %InfPath64%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_\"%PortIP_6_Stock%\"\r\n\r\n\trem postscript 3 farbe\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows x64\" -i %InfPath64ps%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem postscript 6 farbe\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows x64\" -i %InfPath64ps%\r\n\tcscript C:\\Windows\\System32\\Printing_Admin_Scripts\\de-DE\\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_\"%PortIP_6_Stock%\")\r\ngoto exit\r\n\r\n \r\n\r\n:WinXP\r\necho Running Windows XP Script\r\n\r\nrem check if 32 or 64 bit\r\nSet RegQry=HKLM\\Hardware\\Description\\System\\CentralProcessor\\0\r\nREG.exe Query %RegQry% > C:\\Windows\\Temp\\checkOS.txt\r\nFind \/i \"x86\" < C:\\Windows\\Temp\\CheckOS.txt > C:\\Windows\\Temp\\StringCheck.txt\r\n\r\nIf %ERRORLEVEL% == 0 (\r\n\tEcho \"This is 32 Bit WinXP\"\r\n\trem pcl 3 stock s\/w\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows NT x86\" -i %InfPath32%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem pcl 6 stock s\/w\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows NT x86\" -i %InfPath32%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_\"%PortIP_6_Stock%\"\r\n\r\n\trem postscript 3 farbe\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows NT x86\" -i %InfPath32ps%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem postscript 6 farbe\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows NT x86\" -i %InfPath32ps%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_\"%PortIP_6_Stock%\"\r\n\t) ELSE (\r\n    Echo \"This is 64 Bit WinXP\"\r\n\trem pcl 3 stock s\/w\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows x64\" -i %InfPath64%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName3SW% -m %PrnTypePCL% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem pcl 6 stock s\/w\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnTypePCL% -v 3 -e \"Windows x64\" -i %InfPath64%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName6SW% -m %PrnTypePCL% -r IP_\"%PortIP_6_Stock%\"\r\n\r\n\trem postscript 3 farbe\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_3_Stock% -h %PortIP_3_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows x64\" -i %InfPath64ps%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName3Farbe% -m %PrnType% -r IP_\"%PortIP_3_Stock%\"\r\n\r\n\trem postscript 6 farbe\r\n\tcscript c:\\windows\\system32\\prnport.vbs -a -r IP_%PortIP_6_Stock% -h %PortIP_6_Stock% -o RAW -n 9100\r\n\tcscript c:\\windows\\system32\\prndrvr.vbs -a -m %PrnType% -v 3 -e \"Windows x64\" -i %InfPath64ps%\r\n\tcscript c:\\windows\\system32\\prnmngr.vbs -a -p %PrnName6Farbe% -m %PrnType% -r IP_\"%PortIP_6_Stock%\"\r\n\t)\r\ngoto exit\r\n\r\n:exit\r\npause<\/pre>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich wusste lange nicht, wie ich einen Drucker TCP\/IP Port automatisiert erstellen konnte aber bei einem nochmaligen googeln viel mir die L\u00f6sung mit den &#8222;printing admin scripts&#8220; 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[82,7,8,98,99,97,96,88],"class_list":["post-157","post","type-post","status-publish","format-standard","hentry","category-it","tag-batch","tag-drucker","tag-printer","tag-prndrvr","tag-prnmngr","tag-prnport","tag-tcpip-port","tag-windows"],"_links":{"self":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/comments?post=157"}],"version-history":[{"count":6,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":263,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/posts\/157\/revisions\/263"}],"wp:attachment":[{"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/media?parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/categories?post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hamsterhirn.de\/index.php\/wp-json\/wp\/v2\/tags?post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}