locked
How to uninstall antivirus using Powershell script RRS feed

  • Question

  • Hi,

    Is there a way to uninstall antivirus using powershell script. Currently, i'm able to uninstall all other softwares(notepad++, chrome etc...) using powershell, but i was not able to uninstall antivirus.

    I'm using below script to uninstall.

    $app = Get-WmiObject -Class Win32_Product | Where-Object { 
        $_.Name -like "*AVG*" 
    }

    $app.Uninstall()

    It is returning the return code as 1603(fatal error). And, i tried to change the permissions but it was not allowing.

    Please help.

    Thanks

    Bhanuprakash.

    Tuesday, November 14, 2017 5:06 AM

All replies

  • Try this.

    "C:\Program Files (x86)\AVG\AVG2012\avgmfapx.exe" /Appmode=Setup /uninstall /uilevel=Silent /dontrestart
    

    You can check the file location in your system and modify accordingly


    (66,65,83,65,84,73|%{[char]$_})-join''

    Tuesday, November 14, 2017 5:13 AM
  • Contact your AV vendor to find out if it is possible.


    \_(ツ)_/

    Tuesday, November 14, 2017 5:14 AM
  • Hi BASATI,

    Is it powershell command? Because, i'm getting unexpected token "appmode=setup" error.
    And by the way, where to find the path. I've "avgsetupx" path. Shall i use the path?

    Thanks.


    Tuesday, November 14, 2017 5:32 AM
  • Hi jrv Consultant,

    My intention is to uninstall antivirus, not only AVG but 25-30 antivirus like avast, kaspersky, semantic, 360 antivirus etc.....
    I have given example in the script for "AVG".


    Thanks.


    Tuesday, November 14, 2017 5:35 AM
  • Hi,

    It is command line script. You can find the path in "program files" or   "Program Files (x86)".


    (66,65,83,65,84,73|%{[char]$_})-join''

    Tuesday, November 14, 2017 6:42 AM
  • Hi BASAT,

    Is there a way to uninstall using powershell script?

    Tuesday, November 14, 2017 7:21 AM
  • whether you tried to change the permissions successfully?

    (66,65,83,65,84,73|%{[char]$_})-join''

    Tuesday, November 14, 2017 7:22 AM
  • I have tried giving the full permission to the login user for antivirus folder, it is not allowing saying "Access is denied" where as i can able to change the permissions to other software folders.

    Tuesday, November 14, 2017 7:28 AM
  • Hi Bhanuprakash,

    Based on my research, this issue is probably caused by the SYSTEM account does not have Full Control permissions on the folder that you are trying to uninstall. Please have a try to grant full control permissions to the SYSTEM account to see if the issue remains.

    For more information, please refer to the following article:
    You receive an "error 1603: A fatal error occurred during installation" error message when you try to install a Windows Installer package
    https://support.microsoft.com/en-us/help/834484/you-receive-an-error-1603-a-fatal-error-occurred-during-installation-e

    If you need further help, please feel free to let us know.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, November 15, 2017 11:06 AM
  • Hi Albert Ling,

    I tried to give full permissions to AVG folder, but was unable to do that, throwing "Access is denied" error.

    Thursday, November 16, 2017 6:26 AM
  • Hi,

    According to your situation, I recommend contact the antivirus software vendor to see how to uninstall by command line.

    Thanks for your understanding and cooperation.

    Best Regards,
    Albert Ling

    Please remember to mark the replies as an answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, November 16, 2017 12:03 PM
  • if you have windows 10 try 

    get-package

    get-package *avg*

    get-package *avg* | uninstall-package


    Chris

    Monday, November 20, 2017 7:04 PM