Kaseya Community

what is the uninstall shell command

  • Hello all,

    I am trying to write a script to uninstall older versions of windows defender. I have it set to determine whether or not the program is present but I can't figure out how to test if it is old. Also, I need to know the shell command to uninstall the program. The file is named: msmpeng.exe. Any help would be greatly appreciated.

    Thanks,

    Tom


    Legacy Forum Name: what is the uninstall shell command,
    Legacy Posted By Username: tecook7
  • This should be pretty straightforward, as it uses the MSI installer package. On a system with Defender installed, open regedit and browse to hklm\software\microsoft\windows\currentversion\uninstall. You'll see a bunch of folders there. View the contents of each of the folders until you find the version of Defender you want to uninstall. Look at the "UninstallString" key data. This will be the command you run at the command line.

    If you want to do a silent uninstallation, you can _usually_ do it with a command like this (assume UninstallString looks like "msiexec /I{9C876AA5-5C4A-437C-BC71-96233183771D}

    msiexec /qn /x{9C876AA5-5C4A-437C-BC71-96233183771D}


    /qn tells msiexec to use quiet mode no gui. The chars betweenthe bracesrepresent the GUID of the product.



    Using the UninstallString info, you can remove most applications.


    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: nateg
  • thanks for the reply, i've currently figured out a way to uninstall windows defender. my only problem now is that it varies from version to version. is there a universal way to uninstall all versions of windows defender via scripts?

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: tecook7
  • You could write a VB script that loops through each of the registry entries in uninstall, and checks the appropriate version/product name/uninstallstring info.




    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: nateg
  • yes that will work, thanks for the idea

    Legacy Forum Name: System Administration Scripts,
    Legacy Posted By Username: tecook7