Jump to content

Recommended Posts

Posted

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:

:START

IF NOT EXIST "R:\Program Files\Real" (

RKILL /nkill \\%1 r1puninst.exe

EXIT

) ELSE (

SLEEP.EXE 10

GOTO START

)

It works! I used a bunch of windows resource kit utils for this one:

SC.EXE

RCMDSVC.EXE

RCMD.EXE

RKILL.EXE

RKILLSRV.EXE

SLEEP.BAT

Here's the main batch file (real.bat), it uses a single-column list of computer names called "names":

IF EXIST R: NET USE R: /DELETE

FOR /F "eol=" %%i in (names.txt) do call :REAL %%i

GOTO :EOF

:REAL

PING %1 -n 1

IF %ERRORLEVEL% NEQ 0 (

ECHO %1 REAL >>NO_PING.TXT

GOTO :EOF

)

NET USE R: \\%1\C$

IF %ERRORLEVEL% NEQ 0 (

ECHO %1 REAL >>BADPERMS.TXT

GOTO :EOF

)

IF NOT EXIST "R:\Program Files\Real\Realplayer\realplay.exe" (

ECHO %1 REAL >>NOTHERE.TXT

NET USE R: /DELETE

GOTO :EOF

)

RKILL /INSTALL \\%1

START MONITOR.BAT %1

COPY RCMDSVC.EXE R:\

SC \\%1 CREATE RCMDSVC BINPATH= C:\RCMDSVC.EXE

SC \\%1 START RCMDSVC

RCMD \\%1 "C:\Progra~1\Common~1\Real\Update_OB\r1puninst.exe" -all -noask

SC \\%1 STOP RCMDSVC

SC \\%1 DELETE RCMDSVC

DEL R:\RCMDSVC.EXE

RKILL /deinstall \\%1

REM Sometimes the rkill deinstaller tries to delete rkillsrv.exe before the service is completely dead

SLEEP 10

IF EXIST R:\WINNT\SYSTEM32\RKILLSRV.EXE DEL R:\WINNT\SYSTEM32\RKILLSRV.EXE

IF EXIST R:\WINDOWS\SYSTEM32\RKILLSRV.EXE DEL R:\WINDOWS\SYSTEM32\RKILLSRV.EXE

IF EXIST "R:\Program Files\Real" (

ECHO %1 REAL >>BADUNINST.TXT

NET USE R: /DELETE

GOTO :EOF

)

RMDIR "R:\Program Files\Common Files\Real" /s /q

ECHO %1 REAL >>COMPLETE.TXT

NET USE R: /DELETE

GOTO :EOF

YEAH!!!


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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...