batyaPS
15-07-2009, 12:15
В домене на каждой машине имеются принтеры clp1 clp2 clp3 clp4 hp199 hp200 (установлены по IP)
на некоторых установлен Canon (LBP2900 локально) либо clp5 (тот же Canon только переименован).
наваял bat файл
://cmdow @ /hid /min
://@echo off
:// на каждой машине имеются принтеры clp1 clp2 clp3 clp4 hp199 hp200 (по IP) на некоторых установлен
Canon (локально) либо clp5 (тот же Canon только переименован)
:// Удаляем все возможные имеющиеся сетевые принтеры.
rundll32 printui.dll,PrintUIEntry /dn /q /n\\it2_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zgb_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\bkass_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zdgm_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zpek_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\sspr_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zs2_996801\clp5
rundll32 printui.dll,PrintUIEntry /dn /q /n\\sb1_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zhoz_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\gi_996801\Canon
:// если имя компа = xxx то идем туда то
if %computername%==IT1_996801 goto it2_996801
if %computername%==IT2_996801 goto root
if %computername%==BKASS_996801 goto root
if %computername%==ZGB_996801 goto root
if %computername%==PB_996801 goto zgb_996801
if %computername%==BUHPR_996801 goto zgb_996801
if %computername%==SEMENOVA goto zgb_996801
if %computername%==BZP_996801 goto zgb_996801
if %computername%==GB_996801 goto zgb_996801
if %computername%==ZDGM_996801 goto root
if %computername%==ZDGM2_996801 goto zdgm_996801
if %computername%==DGM_996801 goto zdgm_996801
if %computername%==RAO2_996801 goto zdgm_996801
if %computername%==RAO1_996801 goto zdgm_996801
if %computername%==TR_996801 goto zdgm_996801
if %computername%==ZPEK_996801 goto root
if %computername%==SSPEK_996801 goto zpek_996801
if %computername%==SSPR_996801 goto root
if %computername%==ZPR_996801 goto sspr_996801
if %computername%==ZS2_996801 goto clp5
if %computername%==ZS1_996801 goto zs2_996801
if %computername%==NRKZ_996801 goto zs2_996801
if %computername%==SB1_996801 goto root
if %computername%==ZDGM1_996801 goto sb1_996801
if %computername%==ZHOZ_996801 goto root
if %computername%==GI_996801 goto root
if %computername%==ING_996801 goto gi_996801
if %computername%==MP_996801 goto hp199
if %computername%==SDEL_996801 goto hp199
if %computername%==MP_996801 goto hp199
if %computername%==SOP_996801 goto hp200
if %computername%==OP1_996801 goto hp200
if %computername%==OP2_996801 goto hp200
if %computername%==SSPR_996801 goto hp200
if %computername%==NSP_996801 goto hp200
if %computername%==STFAS_996801 goto hp200
goto end
:root
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\Canon
goto end
:hp199
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\hp199
goto end
:hp200
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\hp200
goto end
:clp5
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\clp5
goto end
:it2_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\it2_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\it2_996801\Canon
goto end
:zgb_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zgb_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zgb_996801\Canon
goto end
:zdgm_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zdgm_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zdgm_996801\Canon
goto end
:zpek_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zpek_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zpek_996801\Canon
goto end
:sspr_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\sspr_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\sspr_996801\Canon
goto end
:zs2_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zs2_996801\clp5
rundll32 printui.dll,PrintUIEntry /y /q /n\\zs2_996801\clp5
goto end
:sb1_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\sb1_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\sb1_996801\Canon
goto end
:gi_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\gi_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\gi_996801\Canon
goto end
:end
вроде работает / Но смущает долгая отработка первого этапа bat ника .(удаление всех возможных сетевых принтеров)
Помогите отладить данный bat ник , что бы можно или как то проверять наличие сетевого принтера
с последующим его удалением или заменить перебор принтеров для удаления одной командой (только сетевых )
на некоторых установлен Canon (LBP2900 локально) либо clp5 (тот же Canon только переименован).
наваял bat файл
://cmdow @ /hid /min
://@echo off
:// на каждой машине имеются принтеры clp1 clp2 clp3 clp4 hp199 hp200 (по IP) на некоторых установлен
Canon (локально) либо clp5 (тот же Canon только переименован)
:// Удаляем все возможные имеющиеся сетевые принтеры.
rundll32 printui.dll,PrintUIEntry /dn /q /n\\it2_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zgb_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\bkass_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zdgm_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zpek_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\sspr_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zs2_996801\clp5
rundll32 printui.dll,PrintUIEntry /dn /q /n\\sb1_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\zhoz_996801\Canon
rundll32 printui.dll,PrintUIEntry /dn /q /n\\gi_996801\Canon
:// если имя компа = xxx то идем туда то
if %computername%==IT1_996801 goto it2_996801
if %computername%==IT2_996801 goto root
if %computername%==BKASS_996801 goto root
if %computername%==ZGB_996801 goto root
if %computername%==PB_996801 goto zgb_996801
if %computername%==BUHPR_996801 goto zgb_996801
if %computername%==SEMENOVA goto zgb_996801
if %computername%==BZP_996801 goto zgb_996801
if %computername%==GB_996801 goto zgb_996801
if %computername%==ZDGM_996801 goto root
if %computername%==ZDGM2_996801 goto zdgm_996801
if %computername%==DGM_996801 goto zdgm_996801
if %computername%==RAO2_996801 goto zdgm_996801
if %computername%==RAO1_996801 goto zdgm_996801
if %computername%==TR_996801 goto zdgm_996801
if %computername%==ZPEK_996801 goto root
if %computername%==SSPEK_996801 goto zpek_996801
if %computername%==SSPR_996801 goto root
if %computername%==ZPR_996801 goto sspr_996801
if %computername%==ZS2_996801 goto clp5
if %computername%==ZS1_996801 goto zs2_996801
if %computername%==NRKZ_996801 goto zs2_996801
if %computername%==SB1_996801 goto root
if %computername%==ZDGM1_996801 goto sb1_996801
if %computername%==ZHOZ_996801 goto root
if %computername%==GI_996801 goto root
if %computername%==ING_996801 goto gi_996801
if %computername%==MP_996801 goto hp199
if %computername%==SDEL_996801 goto hp199
if %computername%==MP_996801 goto hp199
if %computername%==SOP_996801 goto hp200
if %computername%==OP1_996801 goto hp200
if %computername%==OP2_996801 goto hp200
if %computername%==SSPR_996801 goto hp200
if %computername%==NSP_996801 goto hp200
if %computername%==STFAS_996801 goto hp200
goto end
:root
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\Canon
goto end
:hp199
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\hp199
goto end
:hp200
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\hp200
goto end
:clp5
rundll32 printui.dll,PrintUIEntry /y /q /n\\%computername%\clp5
goto end
:it2_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\it2_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\it2_996801\Canon
goto end
:zgb_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zgb_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zgb_996801\Canon
goto end
:zdgm_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zdgm_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zdgm_996801\Canon
goto end
:zpek_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zpek_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\zpek_996801\Canon
goto end
:sspr_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\sspr_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\sspr_996801\Canon
goto end
:zs2_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\zs2_996801\clp5
rundll32 printui.dll,PrintUIEntry /y /q /n\\zs2_996801\clp5
goto end
:sb1_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\sb1_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\sb1_996801\Canon
goto end
:gi_996801
rundll32 printui.dll,PrintUIEntry /in /u /w /q /n\\gi_996801\Canon
rundll32 printui.dll,PrintUIEntry /y /q /n\\gi_996801\Canon
goto end
:end
вроде работает / Но смущает долгая отработка первого этапа bat ника .(удаление всех возможных сетевых принтеров)
Помогите отладить данный bat ник , что бы можно или как то проверять наличие сетевого принтера
с последующим его удалением или заменить перебор принтеров для удаления одной командой (только сетевых )