moktar Posted March 22, 2007 Posted March 22, 2007 Taking batch files to the next level, I have created a remote uninstaller for most any version of Realplayer, and I just have to show it off (at least until some joker comes along and tells me how I could have done it 10x easier).It started off innocently enough, run the uninstaller on the remote system with RCMD (I can't use PSTOOLS, my workplace limits me to microsoft-written utilities ONLY), etc, etc. Apparently it can't be run silently. It actually uninstalls the application and then presents the user with a box to click OK, waiting for this OK before removing r1puninst.exe, the uninstaller application. This totally hangs up the RCMD application until I kill the process on the host machine. So what do I do? I write another batch file (monitor.bat) that gets STARTed just before I run the RCMD sequence that goes::STARTIF NOT EXIST "R:\Program Files\Real" (RKILL /nkill \\%1 r1puninst.exeEXIT) ELSE (SLEEP.EXE 10GOTO START)It works! I used a bunch of windows resource kit utils for this one:SC.EXERCMDSVC.EXERCMD.EXERKILL.EXERKILLSRV.EXESLEEP.BATHere's the main batch file (real.bat), it uses a single-column list of computer names called "names":IF EXIST R: NET USE R: /DELETEFOR /F "eol=" %%i in (names.txt) do call :REAL %%iGOTO :EOF:REALPING %1 -n 1 IF %ERRORLEVEL% NEQ 0 (ECHO %1 REAL >>NO_PING.TXTGOTO :EOF)NET USE R: \\%1\C$IF %ERRORLEVEL% NEQ 0 (ECHO %1 REAL >>BADPERMS.TXTGOTO :EOF)IF NOT EXIST "R:\Program Files\Real\Realplayer\realplay.exe" (ECHO %1 REAL >>NOTHERE.TXTNET USE R: /DELETEGOTO :EOF)RKILL /INSTALL \\%1START MONITOR.BAT %1COPY RCMDSVC.EXE R:\SC \\%1 CREATE RCMDSVC BINPATH= C:\RCMDSVC.EXESC \\%1 START RCMDSVCRCMD \\%1 "C:\Progra~1\Common~1\Real\Update_OB\r1puninst.exe" -all -noaskSC \\%1 STOP RCMDSVCSC \\%1 DELETE RCMDSVCDEL R:\RCMDSVC.EXERKILL /deinstall \\%1REM Sometimes the rkill deinstaller tries to delete rkillsrv.exe before the service is completely deadSLEEP 10IF EXIST R:\WINNT\SYSTEM32\RKILLSRV.EXE DEL R:\WINNT\SYSTEM32\RKILLSRV.EXEIF EXIST R:\WINDOWS\SYSTEM32\RKILLSRV.EXE DEL R:\WINDOWS\SYSTEM32\RKILLSRV.EXEIF EXIST "R:\Program Files\Real" (ECHO %1 REAL >>BADUNINST.TXTNET USE R: /DELETEGOTO :EOF)RMDIR "R:\Program Files\Common Files\Real" /s /qECHO %1 REAL >>COMPLETE.TXTNET USE R: /DELETEGOTO :EOFYEAH!!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now