2016年12月3日 星期六

利用 BAT 檔,安裝印表機 (以 RICOH MP 2501 PCL 6 為例)

@echo off

IF NOT EXIST "C:\gpo_log\" (
    mkdir "C:\gpo_log\"
    )

IF NOT EXIST "C:\gpo_log\PrinterInstall.log" (
    echo Remove "RICOH MP 2501 PCL 6" Printer: %date:~0,4%%date:~5,2%%date:~8,2% %TIME:~0,5% >> C:\gpo_log\PrinterInstall.log

    rem 避免因 LOG檔 被刪除,而造成重覆安裝印表機,先執行一次刪除動作
    rem 移除印表機裝置
    rundll32 printui.dll,PrintUIEntry /q /dl /n "RICOH MP 2501 PCL 6"

    rem 移除印表機驅動程式,如不想每次重新安裝驅動程式,可以註解不移除
    rundll32 printui.dll,PrintUIEntry /q /dd /m "RICOH MP 2501 PCL 6"

    rem 開始安裝印表機程序
    echo Start install "RICOH MP 2501 PCL 6" Printer: %date:~0,4%%date:~5,2%%date:~8,2% %TIME:~0,5% >> C:\gpo_log\PrinterInstall.log
    cscript %WINDIR%\System32\Printing_Admin_Scripts\zh-TW\Prnport.vbs -a -r IP_192.168.1.5 -h 192.168.1.5 -o raw -n 9100
    rundll32 printui.dll,PrintUIEntry /ia /m "RICOH MP 2501 PCL 6" /f "\\vmsynology\Driver\Printers\RICOH MP2501SP PCL 6\disk1\OEMSETUP.INF"
    rundll32 printui.dll,PrintUIEntry /u /if /b "RICOH MP 2501 PCL 6" /f "\\vmsynology\Driver\Printers\RICOH MP2501SP PCL 6\disk1\OEMSETUP.INF" /r "IP_192.168.1.5" /m "RICOH MP 2501 PCL 6"
    GOTO END
    ) ELSE (GOTO NonInstall)
   
:END
echo Finish install Printer: %date:~0,4%%date:~5,2%%date:~8,2% %TIME:~0,5% >> C:\gpo_log\PrinterInstall.log
exit 0

:NonInstall
echo The printer is installed: %date:~0,4%%date:~5,2%%date:~8,2% %TIME:~0,5% >> C:\gpo_log\PrinterInstall.log
exit 0

沒有留言:

張貼留言

Nutanix平台虛擬機(UBUNTU),利用Veeam備份移轉至VMware平台,安裝套件、系統更新出現錯誤

 mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-SNUTANIX_VDISK_NFS_4_0_7672_2d41cbaa_025e_4fac_849c_9e620eff5bff-part1 does n...