4 Replies Latest reply on Dec 15, 2016 9:47 AM by woody188

    Script to uninstall/re-install Framepackage on multiple systems

      Hi,

      I require a script which will uninstall and re-install frame package from multiple systems remotely at one go. Can someone assist me on this please.

      Mcafee Version details are as follows

      1) Virusscan enterprise - 8.8.0

      2) Mcafee agent - 5.0.1.516

       

      Operating system details,

       

      Windows 7 SP1 (32 & 64 bit) OS

      Windows 8.0

      Windows 8.1

       

      Let me know if any further details are required from my end.

       

      Regards,

      Suprith Karnad

        • 1. Re: Script to uninstall/re-install Framepackage on multiple systems
          catdaddy

          Moved from Support Forums to VirusScan Enterprise>Discussions

          For better exposure and assistance

           

          skarnad,

                            I assume you are referring to 'Virus Scan Enterprise' ? Hence is why I moved it to this area.

           

           

          All the best,

          Cliff

          Moderator

          Consumer Products

          • 2. Re: Script to uninstall/re-install Framepackage on multiple systems
            woody188

            It's really hard to just write a script as we don't know your environment. I use a cmd script that I wrote that uses Sisinternals PSEXEC. I have two versions, one that goes right to removing Agent and one that tries to ForceInstall Agent.  See the code below. There are more elegant ways to detect the install location but this works. You'll need to have creds/perms (we use Domain/LDAP) on all the systems for this to work. Workstations will need to have admin$ and c$ shares enabled. Good luck!

             

            @echo off

            REM Lasso v.1.13 20161212

            REM Written by Michael Wood Lasso deploys ePO agents to rogue workstations using a txt file. Put the

            REM txt file in the same folder as Lasso, psexec and FramePkg.exe and invoke the program with the txt

            REM file name as the variable. The txt file should be a list of IPv4 addresses of known rogue systems

            REM one each per line.

             

            REM Set some local vars

            SETLOCAL ENABLEEXTENSIONS

            SET me=%~n0

            SET parent=%~dp0

             

            REM set the file time stamps

            FOR /f "tokens=2 delims==" %%i in ('wmic os get localdatetime /format:list') do set datetime=%%i

            set datetime=%datetime:~0,8%-%datetime:~8,6%

            SET error=Lasso_Error_%datetime%.log

            SET success=Lasso_Success_%datetime%.log

             

            REM Check for the results folder

            SET results=%USERPROFILE%\Desktop\Lasso\

            IF EXIST %USERPROFILE%\Desktop\Lasso\ GOTO :file_chk

             

            REM Create and Set our local results folder

            ECHO %me%: Creating the results folder on your desktop...

            MD %USERPROFILE%\Desktop\Lasso\

             

            :file_chk

            REM Check if this is a file or a command line parameter

            ECHO %1 | FIND /I ".csv">NUL && GOTO :fileloop

            ECHO %1 | FIND /I ".txt">NUL && GOTO :fileloop

            GOTO :deploy

             

            :fileloop

            REM Set up the FOR loop

            FOR /F "tokens=*" %%a IN (%1) DO (

              CALL :deploy %%a

            )

            ENDLOCAL

            GOTO :EOF

             

            :deploy

            REM Map the drives

            ECHO %me%: Attempting to map %1 admin drive...

            net use \\%1\admin$ | find "The command completed successfully." >NUL || ECHO %1>>"%results%\%error%"

            IF errorlevel 1 GOTO :EOF

            ECHO %me%: Attempting to map %1 C: drive...

            net use \\%1\c$ | find "The command completed successfully." >NUL || ECHO %1>>"%results"\%error%"

            IF errorlevel 1 GOTO :disc_drive

             

            REM Clean up prior versions of the Agent install

            ECHO %me%: Cleaning up prior versions of ePO Agent install...

            del \\%1\admin$\FramePkg.exe

             

            REM Copies over our new FramePkg.exe and runs it via PSEXEC

            ECHO %me%: Copying new files to %1 and installing the ePO agent.

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 goto :force_uninstall

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

            goto :disc_drive

             

            :force_uninstall

            REM Force the current agent to uninstall after erroring

            ECHO %me%: Looking for McAfee Agent installation...

            REM There are 5 locations where this package is installed

            IF exist "\\%1\c$\Program Files\McAfee\Common Framework\frminst.exe" goto :loc_1

            IF exist "\\%1\c$\Program Files\McAfee\Agent\frminst.exe" goto :loc_2

            IF exist "\\%1\c$\Program Files (x86)\McAfee\Common Framework\x86\frminst.exe" goto :loc_3

            IF exist "\\%1\c$\Program Files\McAfee\Agent\x86\frminst.exe" goto :loc_4

             

            REM This is one of the install locations.

            ECHO %me%: Forcing McAfee Agent uninstall from c:\Program Files (x86)\McAfee\Common Framework\frminst.exe...

            psexec -h -s \\%1 "c:\Program Files (x86)\McAfee\Common Framework\frminst.exe" /forceuninstall

            ECHO %me%: Forcing McAfee Agent re-install...

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 ECHO %1,Error Code %ERRORLEVEL%>>"%results%\%error%"

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

            goto :disc_drive

             

            :loc_1

            REM Another install location.

            ECHO %me%: Forcing McAfee Agent uninstall from c:\Program Files\McAfee\Common Framework\frminst.exe...

            psexec -h -s \\%1 "c:\Program Files\McAfee\Common Framework\frminst.exe" /forceuninstall

            ECHO %me%: Forcing McAfee Agent re-install...

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 ECHO %1,Error Code %ERRORLEVEL%>>"%results%\%error%"

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

            goto :disc_drive

             

            :loc_2

            REM Another install location.

            ECHO %me%: Forcing McAfee Agent uninstall from c:\Program Files\McAfee\Agent\frminst.exe...

            psexec -h -s \\%1 "c:\Program Files\McAfee\Agent\frminst.exe" /forceuninstall

            ECHO %me%: Forcing McAfee Agent re-install...

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 ECHO %1,Error Code %ERRORLEVEL%>>"%results%\%error%"

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

            goto :disc_drive

             

            :loc_3

            REM And another install location.

            ECHO %me%: Forcing McAfee Agent uninstall from c:\Program Files (x86)\McAfee\Common Framework\x86\frminst.exe...

            psexec -h -s \\%1 "c:\Program Files (x86)\McAfee\Common Framework\x86\frminst.exe" /forceuninstall

            ECHO %me%: Forcing McAfee Agent re-install...

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 ECHO %1,Error Code %ERRORLEVEL%>>"%results%\%error%"

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

            goto :disc_drive

             

            :loc_4

            ECHO %me%: Forcing McAfee Agent uninstall from c:\Program Files\McAfee\Agent\x86\frminst.exe...

            psexec -h -s \\%1 "c:\Program Files\McAfee\Agent\x86\frminst.exe" /forceuninstall

            ECHO %me%: Forcing McAfee Agent re-install...

            psexec -h -s \\%1 -c FramePkg.exe /Silent /Install=Agent /ForceInstall

            IF errorlevel 1 ECHO %1,Error Code %ERRORLEVEL%>>"%results%\%error%"

            IF not errorlevel 1 ECHO %1>>"%results%\%success%"

             

            :disc_drive

            REM Disconnect the remove drive

            ECHO %me%: Disconecting from the remote drive on %1...

            net use \\%1\admin$ /delete

            net use \\%1\c$ /delete

            GOTO :EOF

            Exit /B 0

            1 of 1 people found this helpful
            • 3. Re: Script to uninstall/re-install Framepackage on multiple systems
              tao

              You can use ePO Endpoint Deployment Kit 9.6.1 - Enterprise Edition : ePO is the delivery method while winrar is the SFX for the framepkg.exe - within SFX:

               

              ;The comment below contains SFX script commands

              Path=%SystemRoot%\Temp\

              SavePath

              Setup="%SystemRoot%\Temp\FramePkg.exe" /INSTALL=AGENT /FORCEINSTALL /SILENT

              Silent=1

              Overwrite=1

               

              Check SFX package into ePO repository and deploy with a command /s

              • 4. Re: Script to uninstall/re-install Framepackage on multiple systems
                woody188

                I discovered this repository a few weeks ago too. GitHub - LevonBecker/mcafee_clients: Batch Script to Install and Uninstall McAfee Clients on Windows systems Locally.  Levon has done tons of work to put this together and it takes some effort on your part to make it all work correctly, but his scripts are full featured and quite extensive. Not exactly what you were looking for but really good example of clean scripting and what can be done. I hope to someday modify my script to include some of his ideas and build it out more but entirely remote controlled.