none
Uninstall programs using batch file(Mainly antivirus) RRS feed

  • Question

  • I have a requirement that all the client machine( windows 7,8,10) have windows firewalls so that 

    application can modify them but in presence of antivirus it throws error as firewalls configured are not 

    applied because antivirus uses its own firewall and disable the windows firewalls. So I have written script 

    by going through some google search but it is not working as wmic is not listing my antivirus(Avast/McAfee).

    Following is the script:

    @echo off

    setlocal enabledelayedexpansion   

    set "i=0"   

    for /F "delims=" %%f in ('wmic /node:localhost /namespace:\\root\SecurityCenter2 path AntiVirusProduct Get DisplayName ^| findstr /V /B /C:displayName ^| findstr /V /R /C:"^[  ]*$"') do (      

    set arr[!i!]=%%f       set /a "i+=1"   

    )   

    set arr   

    set "len=!i!"   

    set "i=1"

    :loop   

    echo !arr[%i%]!   

    wmic product where "description='!arr[%i%]'" uninstall   

    set /a "i+=1"   

    if %i% neq %len% (  

        goto:loop   

    )

    endlocal

    But this is not working as it says there is not instance for both Avast/McAfee.

    Thanks

    • Moved by Bill_Stewart Wednesday, September 4, 2019 6:22 PM This is not third party support forum
    Thursday, March 7, 2019 1:43 PM

All replies

  • What you are trying to do cannot be done.  Contact your AV vendor for help.

    Contact application vendor to resolve issues with their software.  Scripting cannot help you with this.


    \_(ツ)_/

    Thursday, March 7, 2019 1:55 PM