卸载客户端(毕竟占用一些网络带宽,360把它列为高危,奶奶的真烦人,客户端人比较不爽)

1. 直接卸载

2. 通过域策略卸载

卸载脚本内容如下uninstall_agent.bat

-----------------------------------------------------------------------------------------

rem File uninstall_agent.cmd

rem Untested on W9X (command.com) - please run with cmd.exe

rem To only remove service:

rem sc.exe delete "OCS INVENTORY"

rem On Windows 2000 use delsrv.exe instead of sc.exe

%SystemDrive%

cd "%ProgramFiles%"

if not exist "OCS Inventory Agent" goto end

cd "OCS Inventory Agent"

if exist uninst.exe call uninst.exe /S

del *.* /s /q

cd ..

rd "OCS Inventory Agent" /s /q

:end

cd /

因为权限的关系 直接调用以上脚本还不行

可以利用autoit提升权限调用uninstall_agent.bat 达到卸载的目的

Autoit 脚本内容如下uninstall_agent.au3

Local $pid = RunAsWait( "administrator", "mdbq", "13451971056", 0, "//192.168.0.11/soft/uninstall_agent.bat" , @ScriptDir )

ProcessWaitClose($pid)

然后配合域策略使用达到卸载

clip_image022

clip_image024

 

俺的简单办法:

@echo off

set log=ocs_agent_uninstall.txt

echo 脚本执行时间: %date% %time% > %log%

echo ----------------------------------------- >> %log%
::%%i -> ServerName
FOR /f "eol=; skip=1 tokens=1,2" %%i IN (ip.txt) DO (

echo.
echo ================================================
echo Host [%%i]
echo Host [%%i] >> %log%
d:\xbq\psexec.exe \\%%i cmd /c "C:\Program Files (x86)\OCS Inventory Agent\uninst.exe" /s>> %log%
echo ================================================ >> %log%
)

 

posted on 2013-10-14 16:45  viento  阅读(496)  评论(0编辑  收藏  举报